在android textview中显示阿拉伯语文本(Display Arabic text in android textview)
我正在尝试开发Android应用程序,其中我将html文件保存在资产文件夹中,这些文件包含阿拉伯语文本,如此“قلاللهممالكالملكتؤتيالملكمنتشاءوتنزعالملكممنتشاء”我想设置文本视图whit我试过这个文本波斯语类,但它没有正确显示它。 有任何想法吗 ?
i'm trying to develop android app where i have html files saved in asset folders , these files contain Arabic text like this "قُلِ اللَّهُمَّ مَالِكَ الْمُلْكِ تُؤْتِي الْمُلْكَ مَنْ تَشَاءُ وَتَنْزِعُ الْمُلْكَ مِمَّنْ تَشَاءُ " i want to set text view whit this text i tried Farsi class but it doesn't show it properly. any ideas ?
原文:https://stackoverflow.com/questions/33066426
更新时间:2023-07-08 10:07
最满意答案
我认为您可以更改代码的读取方式
report = {} with open("file.txt") as f: for line in f: line = line.strip().split('\t') report[line[1]] = report.get(line[1],0) + 1
I think you can change the code how you read the file
report = {} with open("file.txt") as f: for line in f: line = line.strip().split('\t') report[line[1]] = report.get(line[1],0) + 1
相关问答
更多-
仅限Python 2.x(谢谢Alex): yourdict = {} # ... items = yourdict.items() 有关详细信息,请参阅http://docs.python.org/library/stdtypes.html#dict.items 。 仅适用于Python 3.x(取自Alex的答案 ): yourdict = {} # ... items = list(yourdict.items()) For Python 2.x only (thanks Alex): yourd ...
-
似乎这应该工作,虽然我想这不是一个单一的功能: dict(zip(["key1","key2","key3"], ["val1","val2","val3"])) 从这里: 如何将两个列表组合到Python中的字典中? Seems like this should work, though I guess it's not one single function: dict(zip(["key1","key2","key3"], ["val1","val2","val3"])) from here: H ...
-
尝试这个, >>>someDict = {'One': 1, 'Two': 2, 'Three': 3} >>>someList = list(someDict.keys()) >>>print(someList) ['One', 'Two', 'Three'] Try this, >>>someDict = {'One': 1, 'Two': 2, 'Three': 3} >>>someList = list(someDict.keys()) >>>print(someList) ['One', 'Tw ...
-
使用循环和临时dictionary_variable: tmp_dict = x for key in lst[:-1]: tmp_dict = tmp_dict[key] tmp_dict[lst[-1]] = value print x 请注意,除了最后一个键之外的所有键的循环,因为我们需要最后一个键用于赋值操作。 Use a loop an a temporary dictionary_variable: tmp_dict = x for key in lst[:-1]: tmp_d ...
-
Python - dict中键的每个值的平均值[duplicate](Python - Mean of each value across keys in dict [duplicate])[2023-07-22]
做就是了 : #loop through the dictionary for key,value in test_dict.items(): #use reduce to calculate the avg print(key, reduce(lambda x, y: x + y, test_dict[key]) / len(test_dict[key])) 这将打印: NJ 66.0 NY 33.8 CT 220.08 编辑:根据OP要求的变化: l = list(iter(test ... -
我认为您可以更改代码的读取方式 report = {} with open("file.txt") as f: for line in f: line = line.strip().split('\t') report[line[1]] = report.get(line[1],0) + 1 I think you can change the code how you read the file report = {} with open("file.txt") ...
-
您可以使用fromkeys() : somelist = ['a', 'b', 'c', 'd'] somedict = dict.fromkeys(somelist, 1) 你也可以使用字典理解(感谢Steven Rumbalski提醒我) somedict = {x: 1 for x in somelist} 如图所示, fromkeys效率稍高一些。 >>> timeit('{a: 1 for a in range(100)}') 6.992431184339719 >>> timeit('dic ...
-
input_dict = csv.DictReader(open("./MCPlayerData/AllPlayerData2.csv")) input_dict.fieldnames 将为您提供所需的密钥,请参阅csv.DictReader input_dict = csv.DictReader(open("./MCPlayerData/AllPlayerData2.csv")) input_dict.fieldnames will give you the keys you want, se ...
-
# group the list into sublists sharing the same day data.group_by { |element| element['day'] }.map { |day, element_list| # for each day, return a new object { day: day, # extract the count from all the elements in the sublist, # then add ...
-
查找列表+ 2输入的平均值 - python [duplicate](Find average of list + 2 inputs - python [duplicate])[2022-12-30]
操作顺序存在问题。 你需要改变: average_assignment_grade = sum(x) + midTermGrade + finalGrade / 7 至: average_assignment_grade = (sum(x) + midTermGrade + finalGrade) / 7 您可以在这里阅读Python运算符优先级。 There is a problem with order of operations. You need to change: average_ass ...