not all arguments converted during string formatting
This is a topic that many people are looking for. https://granthamandira.org/ is a channel providing useful information about learning, life, digital marketing and online courses …. it will help you have an overview and solid multi-faceted knowledge . Today, https://granthamandira.org/ would like to introduce to you String Formatting in Python 3.5 – Pro Tip. Following along are instructions in the video below:
hey guys whats up this is Kazi from clever programmer comm and today im coming at you with a pro tip in this video I want to show you guys the beauty of something called format and all the cool kids are using it so lets just get started heres how it works I will say something and like a quote or a string with the two quotation marks around it and I will pass in dot format and if i said five heres what it will do this squiggly brackets that you see its using that as a placeholder and in place of that ill put in whatever I pass to the format method so if I pass in five youll
say hello world five if I pass in ten itll pass in ten so a cool example of this would be if I wanted to do count from one to ten and I wanted to say the word count and then I wanted to say one after it so for example I wanted something to look like this and then in the next one to look like this well whoops Im sorry to look like this okay so I can do that very easily I can write a for loop that starts from one and lets say it goes all the way up to eleven it goes up to but not including, 11 however it does start from one which means itll
print one and it will go up to ten but not 11 all right lets hit this guy here and I will say print I or Im sorry print count because thats something I want to show and I want to put that right there the squiggly brackets and I can say doc format hmm and from that I can put I because thats our variable were incrementing by and Im gonna hit enter a few times and you can see count one count to count three count four count five all up to ten how beautiful does that look pretty damn beautiful how can you use it well if youre making a game like battleships or something else you can use
to format your code instead of those % placeholders or instead of doing something like hello world plus one and then you realize it gives you an error because you cant combine a number with the string so you got a pass STR around it which is again something thats ugly then youre like oh its still not formatted correctly so you got to put this space after it and its its a whole mess instead use the format way look at how gorgeous that is first of all look at that and it just works right I dont know where I got those syntax or front but it works thats it for this video Ill see you guys in the next video
cleverprogrammer, programming, python, coding, string, string formatting, string interpolation, squigly brackets, placeholders, text, python 3.5, computer pr…
Thank you for watching all the articles on the topic String Formatting in Python 3.5 – Pro Tip. All shares of https://granthamandira.org/ are very good. We hope you are satisfied with the article. For any questions, please leave a comment below. Hopefully you guys support our website even more.