Python Forum
finding items/comparison in/with a dictionary
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
finding items/comparison in/with a dictionary
#3
Thanks!
I figured that I had to strip the return line character at the end;
THis is my new code:
for key in annotation:
		for line in file2:
			if line.startswith('>'):
				gene=line[1:]
				gene=gene.strip('\n')
				if gene == key:
Reply


Messages In This Thread
RE: finding items/comparison in/with a dictionary - by AGC - Apr-02-2018, 06:05 PM
for loop not loopng through dictionary - by AGC - Apr-02-2018, 06:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Finding combinations of list of items (30 or so) LynnS 1 921 Jan-25-2023, 02:57 PM
Last Post: deanhystad
  how to assign items from a list to a dictionary CompleteNewb 3 1,654 Mar-19-2022, 01:25 AM
Last Post: deanhystad
  Calculating frequency of items in a dictionary markellefultz20 1 1,775 Nov-27-2019, 04:21 AM
Last Post: scidam
  Python find the minimum length of string to differentiate dictionary items zydjohn 3 3,699 Mar-03-2018, 05:23 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020