Aug-25-2019, 01:38 PM
(Aug-25-2019, 01:28 PM)snippsat Wrote: Your expatiation is okay @newbieAuggie2019,but there is better way to get the string output.
Convertstr(x)
and+
,is maybe okay in this small scale,but can become ugly very soon if string is longer.
String formatting as linked be @Yoriz,is a nicer way to do it.
my_string = ("go") my_list = [1, 2, 3, 4] for item in my_list: print(f'{myString} {item}')Also a lot of powers in this way if need an other look for the output.
Output:go 1 go 2 go 3 go 4
my_string = ("go") my_list = [1, 2, 3, 4] for item in my_list: print(f'|{myString} -->{item:3}|')
Output:|go --> 1| |go --> 2| |go --> 3| |go --> 4|
Wow, thank you!
I'm still a newbie, so my knowledge is almost zero, but I'm learning a bit, mostly by imitating code I see, that I can understand and use or tweak.
Thank you for making me aware of more ways to format and use strings. I had already seen and tweaked some in a few posts here about splitting email addresses.
All the best,
newbieAuggie2019
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs