python中三个双引号 的作用是什么?1、多行注释 2、定义多行字符串(代替转义字符换行符 \n)
生活随笔
收集整理的這篇文章主要介紹了
python中三个双引号 的作用是什么?1、多行注释 2、定义多行字符串(代替转义字符换行符 \n)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
作用1:多行注釋
# 這是單行注釋""" 這是多行注釋第一行 這是多行注釋第二行 這是多行注釋第三行 """作用2:定義多行字符串(無需轉義字符 \n)
如:
# -*- coding: utf-8 -*- """ @File : 191208_test_Eager_execution_once_cls.py @Time : 2019/12/8 12:25 @Author : Dontla @Email : sxana@qq.com @Software: PyCharm """import tensorflow as tftf.enable_eager_execution()ds_tensors = tf.data.Dataset.from_tensor_slices([1, 2, 3, 4, 5, 6]) # print(type(ds_tensors)) # <class 'tensorflow.python.data.ops.dataset_ops.TensorSliceDataset'> # print(ds_tensors) # TensorSliceDataset shapes: (), types: tf.int32># Create a CSV file import tempfile_, filename = tempfile.mkstemp(dir='./')with open(filename, 'w') as f:f.write("""Line 1 Line 2 Line 3""")ds_file = tf.data.TextLineDataset(filename)with open(filename, 'r') as f:print(f.read())結果:
Line 1 Line 2 Line 3參考文章:Python中三個雙引號的作用是什么?
總結
以上是生活随笔為你收集整理的python中三个双引号 的作用是什么?1、多行注释 2、定义多行字符串(代替转义字符换行符 \n)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: tensorflow tf.data.D
- 下一篇: tensorflow tf.data.T