0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

python print ”sepとend”

Posted at

print(sep='')

printに引数sep=''を渡すと複数データの区切り文字を指定できる。
下の例ではnameとageのデータを:で区切って出力している。
デフォルトはスペースsep=' '

print sep
name = 'bob'
age = 43

# default sep=' '
print(name, age)
#bob 43

#sep=':'
print(name, age, sep=':') 
# bob:43

print(end='')

printに引数end=''を渡すと最後の文字を指定できる。
デフォルトは改行end='\n'

pirnt end
name = 'dodo'
age = 3

#default end='\n'
print(name)
print(age)
# dodo
# age

# end='=>'
print(name, end='=>')
print(age)
# dodo=>3
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?