目前,我正在使用import os
import csv
import requests
import time
write_path = '/Users/macossierra/Desktop/pdf' # ASSUMING THAT FOLDER EXISTS!
with open('this.csv', 'r') as csvfile:
spamreader = csv.reader(csvfile)
for link in spamreader:
if not link:
continue
print('-'*72)
pdf_file = '{}_{}.pdf'.format(link[0], int(time.time()))
with open(os.path.join(write_path, pdf_file), 'wb') as pdf:
try:
# Try to request PDF from URL
print('Trying To Connect with Link>>>>>. {}...'.format(link[1]))
a = requests.get(link[1], stream=True)
for block in a.iter_content(512):
if not block:
break
pdf.write(block)
print('File Downloaded Successfully.')
except requests.exceptions.RequestException as e: # This will catch ONLY Requests exceptions
print('REQUESTS ERROR:')
print(e) # This should tell you more details about the error
作为主要语言的Android项目。我使用English
文件作为字符串常量。
现在,我想基于Web服务动态更改语言。此服务将根据用户选择(在“设置”中)创建。
我知道我们必须为每种语言创建单独的strings.xml文件 支持。
但在我的情况下,用户将在服务器应用程序中创建字符串常量以获得多语言支持。这些字符串将转换为JSON Web服务。现在,我想访问该服务并动态更改语言。
此外,如何在本地存储这些字符串(SharedPreference或Realm DB或其他任何东西)