简体   繁体   中英

how to print some text and a function result on one line in python?

I'm using python3.6. I'm trying to print some text and a result of a function on one line.

print("Type of partition:")
type_of_partition(partentry)

This gives me:

Type of partition:
FAT 16

but I want them on the same line as it looks friendly. I tried

print("Type of partition: ", type_of_partition(partentry))

this gives me:

Type of partition: None
FAT 16

I tried:

print("Type of partition: %s" % type_of_partition(partentry))

this gives me:

FAT 16
Type of partition: None

How can I put them together?

type_of_partition函数的print result更改为return result

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM