Linked Questions

0 votes
2 answers
296 views

I have written the following code for a program to display the image path names in a folder. However, as seen in the output, the pictures' paths are not being displayed in the correct order despite me ...
Sibi's user avatar
  • 2,451
1 vote
2 answers
770 views

Doing glob.glob('/var/log/apache2/other_vhosts_access.log*') gives an unsorted list such as ['....76.gz', '....16.gz', '....46.gz', ...]. Also, sorted(glob.glob('/var/log/apache2/other_vhosts_access....
Basj's user avatar
  • 47.6k
0 votes
2 answers
820 views

I'm wanting to rename all of the files in a directory. When sorted by name in Windows Explorer, they appear in the correct order: Cue 001 - 002.mp3 ... Cue 001 - 010.mp3 Cue 001 - 011.mp3 ... Cue 001 ...
David Walden's user avatar
0 votes
2 answers
131 views

how would you sort a list of numbers like 5.1, 5.2, 5.3,... 5.10,5.11 in a way that doesn't put 5.10 and 5.11 after 5.1 in Python. I basically want python to realize that I don't actually mean 5.10 ...
Natsu TRO's user avatar
3 votes
1 answer
225 views

Possible Duplicate: Does Python have a built in function for string natural sort? Is there a function in python equivalent to php's natcasesort()? http://php.net/manual/en/function.natcasesort....
Quamis's user avatar
  • 11.2k
0 votes
2 answers
457 views

I'm currently trying to sort a list of the form: [["Chr1", "949699", "949700"],["Chr11", "3219", "444949"], ["Chr10", "699", "800"],["Chr2", "232342", "235345234"], ["ChrX", "4567", "45634"],["Chr1", ...
Megatron's user avatar
  • 17.3k
0 votes
1 answer
444 views

I have a folder of fits files that are all labelled img_1.fits, img_32.fits, img_2.fits ... etc and I want to iterate through them in numerical order and append the data to an array however I cannot ...
cbtohill's user avatar
1 vote
1 answer
219 views

I have the following list which is the output of mylist.sort() ['0_sound.wav', '10_sound.wav', '15_sound.wav', '20_sound.wav', '5_sound.wav'] This makes sense, since the filenames are treated as ...
Data Mastery's user avatar
  • 2,165
1 vote
3 answers
104 views

I need to sort this list list = ['16. Michlík', '4. and 65. Bichakhchyan', '15. Pavol'] according to first number of each string. So that output should look like this list = ['4. and 65. ...
P. May's user avatar
  • 95
1 vote
3 answers
221 views

numbers = ['3','1','6','5','4','4','3','2','1','4','3','5','4','9','84','7','878','6'] counts = dict() for number in numbers: counts[number] = counts.get(number, 0) + 1 print counts for k,v in ...
Issam's user avatar
  • 15
2 votes
4 answers
189 views

I have a python dictionary named data and have sub dictionaries inside it, such as data = {'ind1' : {}, 'ind10' : {}, 'ind11' : {}, 'ind12' : {}, 'ind13', 'ind14' : {}, 'ind15' : {}, 'ind16' : {}, '...
Kangkon Saikia's user avatar
1 vote
3 answers
122 views

I have a list of files that looks something like this: listOfFiles = ['XLOG100.LOG', 'XLOG101.LOG', 'XLOG102.LOG', 'XLOG103.LOG', 'XLOG104.LOG', 'XLOG105.LOG', 'XLOG106.LOG', 'XLOG107.LOG', 'XLOG108....
MrmDdda's user avatar
  • 51
0 votes
0 answers
298 views

I have a list of ['rs12345','rs21','rs55189']; I need to sort them as numbers after strip the prefix 'rs'. How can I do it in Python ? # row.keys() is ['rs12345','rs21','rs55189'] fieldnames = sorted(...
Galaxy's user avatar
  • 2,072
0 votes
1 answer
113 views

I've read many similar questions, but none of the solutions match the requirements I need which is, using Python 2.6.6 and without installing or using OrderedDict, how can I get my list to sort based ...
Awsmike's user avatar
  • 911
0 votes
3 answers
95 views

I would like to sort the following list by numbers : x = ('a-34','a-1','a-0', 'a-11', 'a-2') y = sorted(x) print(y) This produces : ['a-0', 'a-1', 'a-11', 'a-2', 'a-34'] But I need : ['a-0', 'a-1', '...
Sofia's user avatar
  • 21

15 30 50 per page
1 2
3
4 5
17