Fecha de registro: 15 may 2022


Torrent Delphi 7 Enterprise Update yeaeif




Category:Borland Software Category:Embedded databases Category:Integrated development environments Category:Pascal softwareQ: How to read all line in a file in specific order in python? I have a file named myfile.txt. The content of myfile.txt is: aaa.txt bbb.txt I am using the next code to load it into a dictionary: with open("myfile.txt") as file: for line in file: mydict[line.rstrip()]=1 Now I want to read all the lines in myfile.txt, but in a specific order. for example, the order of read is: line1: "aaa.txt" line2: "bbb.txt" line3: "ccc.txt" line4: "ddd.txt" ... The output for the dictionary will be: mydict={'aaa.txt': 1, 'bbb.txt': 1, 'ccc.txt': 1, 'ddd.txt': 1,....} How can I do this? A: Here is my solution: read_lines_order = ['bbb.txt', 'ccc.txt', 'ddd.txt', 'aaa.txt'] read_lines_file = open('myfile.txt') for line in read_lines_file: if line.strip().endswith('.txt'): mydict[line.rstrip()]=1 read_lines_file.close() Joaquín Molla Joaquín Molla (1887–1956) was a Spanish geographer and cartographer, active during the mid 20th century. He was the director of the National Cartographic Institute and leader of the National Cartographic Council. Molla was born in Almeria and died in Madrid. Publications References Category:1887 births Category:1956 deaths Category:People from Almería Category:Spanish geographers Category:20th-century Spanish peopleMost notably, women who are using the contraceptive pill or have had breast surgery are much more likely to suffer from poly




Torrent Delphi 7 Enterprise Update yeaeif

Más opciones