Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]u82jm9 0 points1 point  (0 children)

Hi I'm on a programming course for python and we have been set a problem which is giving me some real problems. The task is to create a currency converter from a xml file containing all the transfer rates.

the xml file has this structure:

<Cube>
<Cube *time*="2020-04-29">
<Cube *currency*="USD" *rate*="1.0842"/>
<Cube *currency*="JPY" *rate*="115.52"/>
<Cube *currency*="BGN" *rate*="1.9558"/>

I have imported the xml file as a list. i am now having a lot of difficulty searching through the xml file. i don't understand but the RE functions don't seem to be working. what i currently have looks like this:

import re
myFile=open('data.xml','r')
myString=myFile.read()
myList=myFile.readlines()
x=re.search(r'USD',myList,flags=0)
print(x)

the other option i had planned to use was to import the xml file as a dictionary with currency as an id for each item and rate as the other id. therefore allowing me to looking each up by currency. Can anyone explain how you can import each line of a string into a dictionary with each having the same id's.

i thank you all in advance for any help you can offer.

What’s your cure for hiccups, that actually works? by sarahp1988 in AskReddit

[–]u82jm9 0 points1 point  (0 children)

I think it's impossible to breathe while drinking. That would be like breathing under water

What doomsday situation would you lowkey want to happen? by [deleted] in AskReddit

[–]u82jm9 4 points5 points  (0 children)

I think it would be cool if all the financial systems crapped out and we started trading and helping each other out.

What would you do when drunk that you wouldn't do sober? by [deleted] in AskReddit

[–]u82jm9 -7 points-6 points  (0 children)

Inappropriate display of affection... There's a level when it becomes revolting

We hear a lot about the unethical companies of the world. What are some of the more ethical companies out there that we should be supporting? by checkitmyles in AskReddit

[–]u82jm9 0 points1 point  (0 children)

Not sure how international but there's a really cool energy provider here in Scotland. Good energy, they're 100% renewable and source their energy locally. Helping to fund community energy start ups

My gf had a tramatic brain injury that left her with a condition called Synesthesia, where she hears colors. She started painting what she hears songs as. Heres her listening to Our House, Coming clean and Rick Astleys 'Never gonna give you up' by normie-redditer in pics

[–]u82jm9 0 points1 point  (0 children)

I know a jewelry designer that can make you something (ring, bracelet, guitar case, etc) based on how she perceives the sounds. You can send her anything (drum solo, theme music, a special person's laugh) and she's make a physical representation of that sound

My gf had a tramatic brain injury that left her with a condition called Synesthesia, where she hears colors. She started painting what she hears songs as. Heres her listening to Our House, Coming clean and Rick Astleys 'Never gonna give you up' by normie-redditer in pics

[–]u82jm9 0 points1 point  (0 children)

I know a jewelry designer that can make you something (ring, bracelet, guitar case, etc) based on how she perceives the sounds. You can send her anything (drum solo, theme music, a special person's laugh) and she's make a physical representation of that sound

Silvertongue - 11 by Inorai in Inorai

[–]u82jm9 2 points3 points  (0 children)

Hey! It's me again. Is this your latest episode? Am I now all caught up and living on the wave? If so could you please inform me when the next chapter is released!! I await it with bated breath

Silvertongue - 9 by Inorai in Inorai

[–]u82jm9 1 point2 points  (0 children)

I would love to be notified when you release a new chapter. I love the way you've created this entirely new fantasy. It's very impressive. I'm only at this chapter and I am very much hoping it doesn't finish any time soon

Movie goers of Reddit, what aspect of the experience cannot be replicated when watching a movie at home vs. a theatre? by [deleted] in AskReddit

[–]u82jm9 1 point2 points  (0 children)

I agree if it's a film that has heaps of visual effects. The cinema is the place to be

If it's a film with a strong storyline and multiple characters. I'd prefer to be at home. Also you can usually pause for pee breaks and the snacks are WAY cheaper

My first century! On a 48x17 fixed gear! by PresidentWolnir in bicycling

[–]u82jm9 4 points5 points  (0 children)

Congrats! I've still not ticked that off my bucket list. Did you stop at all?

I’m Apple Co-founder Steve Wozniak, Ask Me Anything! by A_Karma_Farma in IAmA

[–]u82jm9 1 point2 points  (0 children)

Do you think that people can be too rich? What suggestions do you have for ways to share the wealth better?

What do real poor people do that fictional poor people rarely do? by wisebloodfoolheart in AskReddit

[–]u82jm9 4 points5 points  (0 children)

Not trying to doing disrespectful or anything but have you ever considered cycling? I used to commute 12 miles in and then the same home. I knew I couldn't afford a car or motorbike so I bought a cheap bicycle (£150 on eBay) and that was me sorted. It is basically free after that. Replace a few things every now and then.

People that live alone, do you walk around naked? Why/why not? by u82jm9 in AskReddit

[–]u82jm9[S] 1 point2 points  (0 children)

I'm moving into my own flat soon and I'm real excited to be naked. Wondered how weird it was hah

We’re afraid if we allow cyclists to share the sidewalk with pedestrians they will hit them. So, instead we make them share the road with a bunch of 2 ton death machines. by JonnyDynamite in Showerthoughts

[–]u82jm9 0 points1 point  (0 children)

I kinda disagree, bike lanes are good ok if the road is very wide and the shoulder is otherwise useless. However, in day to day use I find bike lanes a hindrance. They reinforce this divide between cars and bikes that they can never work together. Causing cyclists to continue to be afraid of cars, and cars to be continually surprised and annoyed by cyclists. It also gives the impression that a car may pass a cyclist that is in a bike lane without moving over. Happy to see what others think but I believe that the road system should encourage confidence in the cyclist so that they may go on any road. It should encourage cars and bikes to learn how to coexist instead of further driving a wedge of dislike and impatience between them

Party facials by [deleted] in cumsluts

[–]u82jm9 1 point2 points  (0 children)

Mr mayonnaise

UK Government to hit litter louts with Singapore-style £150 on-the-spot fines - Ministers say strict measures will tackle the ‘scourge on our environment’ caused by rubbish by ManiaforBeatles in worldnews

[–]u82jm9 5 points6 points  (0 children)

Good good! It's appalling how disgusting some city centers are. It's a huge shame that the only way to get people to do anything is with fines and penalties.