当前第2页 返回上一页
在要插入较多的元素时候
1 2 3 4 5 | name = input( '请输入你的名字:' )
data = input( '请输入发送内容:' )
dest_ip = input( '请输入ip:' )
dest_port = 2425
chat_socket.sendto( '1:123456:发送者的名称:{my_name}:32:{my_data}' .format(my_name=name,my_data=data).encode( 'gbk' ),(dest_ip,dest_port))
|
直接format()一下,在后面慢慢给其赋值
更多Python相关技术文章,请访问Python教程栏目进行学习!
以上就是python 怎么向字符串中添加元素的详细内容,更多文章请关注木庄网络博客!!
返回前面的内容
相关阅读 >>
Python中的元类(metaclass)是什么
Python怎么读写excel
j详解Python利用rsa库做公钥解密的方法
如何使用 pylint 来规范 Python 代码风格(来自ibm)_Python
Python中sqrt函数怎么用
Python numpy函数中linspace实现创建等差数列的实例分享
Python怎么调用idle
Python中flask的session设置的方法介绍
Python操作excel文件的案例
Python类是什么
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » python 怎么向字符串中添加元素