Print C format in Python

0 votes

Hi, I am a beginner in Python programming and I want to know how to print with the C format in Python with a list of parameters such as :

agrs = [1,2,3,"hello world"]
string = "This is a test %d, %d, %d, %s"


The Output should be:
This is a test 1, 2, 3, hello world
Sep 18, 2018 in Python by ana1504.k
• 6,830 points
28 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

For printf- style formatting and special case Tuple for formatting multiple value, string overloads the modulus (%) operator. the simple way to do it is by converting list to tuple

answered Sep 18, 2018 by SDeb
• 11,100 points

Related Questions In Python

0 votes
0 answers

How can you print the date in a regular format in python?

Is there a module or package in ...READ MORE

6 days ago in Python by Waseem
• 2,790 points
8 views
+2 votes
11 answers

How to print array/ list without brackets in python?

name=["a","b","c"] print (', '.join(name)) It will simply take all ...READ MORE

answered Apr 18, 2018 in Python by aayushi
• 750 points
14,573 views
0 votes
1 answer

How to print first character of each word in upper case of a string in Python

You can use split() using space as ...READ MORE

answered Jun 1, 2018 in Python by george
• 200 points
1,210 views
+3 votes
2 answers

how to print array integer without [] bracket in python like result = 1,2,3,4,5

Hey @abhijmr.143, you can print array integers ...READ MORE

answered Aug 4, 2018 in Python by Omkar
• 66,990 points

edited Aug 8, 2018 by Omkar 339 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
64 views
0 votes
1 answer

Equivalent of a?b:c in Python

In Python 2.5, you can use ternary ...READ MORE

answered Jan 7 in Python by SDeb
• 11,100 points
12 views
0 votes
1 answer

Indentation of Python in Notepad++

To indent the block, select the entire ...READ MORE

answered Sep 18, 2018 in Python by SDeb
• 11,100 points
139 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.