Python模块
来源:互联网 发布:书生阅读器windows版 编辑:程序博客网 时间:2024/06/10 22:59
# python中的模块就好比C\C++中的头文件# python应该是类JAVA的语言,使用import导入模块import stringprint(string.capwords("i love wth")) # 将各个单词的首字符大写# print(capwords("i love wth")) # 直接调用,失败from string import capwords # 从string模块中引入函数capwordsprint(capwords("i love wth")) # 直接调用成功import string as stringNewName # 调用模块并使用别名print(stringNewName.capwords("i love wth"))from string import * # 导入所有函数,类似于JAVA的设计print(dir(string)) # 输出里面所定义名字的列表print(__name__) # 如果当前脚本是独立运行的那么__name__返回值为__main__,首发于我的个人网站: 点击打开链接
0 0
- python模块 ---logging模块
- python模块-re模块
- python模块 - functools模块
- python 模块 模块文件
- python模块 - pickle模块
- python模块 - copy模块
- python模块
- python 模块
- python-模块
- python 模块
- python模块
- python 模块
- python模块
- python 模块
- python 模块
- 模块-python
- python 模块
- python模块
- 【HDU】-1159-Common Subsequence(LCS,模板)
- 用sql语句创建表
- 【OVS2.5.0源码分析】normal action精确流表生成和刷新过程分析
- Leetcode no. 67
- 软件开发实践中的入队列和出队列操作的C代码示例
- Python模块
- c++ string类实现
- MySQL集群系列1:2台机器搭建双主集群
- Android Fragment的子fragment之间切换保存状态遇到的坑
- 【机房收费】--VB让报表有生命
- sublime text3常见插件的安装
- 网络基础框架
- ios 判断图片类型是否为PNG
- SecureCRT-v8.0.2的安装与破解