1 Star 0 Fork 0

Fate_ZTC/python_study

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.py 1.26 KB
一键复制 编辑 原始数据 按行查看 历史
tianchengz 提交于 2024-08-27 14:46 . 增加代码提交
# This is a sample Python script.
import encodings
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
class MyTestStr:
name = ""
age = 0
address = ""
# 定义构造方法
def __init__(self, name, age, address):
self.name = name
self.age = age
self.address = address
def __str__(self):
return "name: %s, age: %d, address: %s" % (self.name, self.age, self.address)
def speak(self):
print("%s 说: 我 %d 岁。" % (self.name, self.age))
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
# p = MyTestStr('ztc', 18, '天天超市')
# print("我是一个类:" + str(p))
# p.speak()
a = "我"
str_bytes = bytes(a, encoding='utf-8')
binary_representation = [bin(byte) for byte in str_bytes]
print(binary_representation)
demo_dict = {'name': 'ztc', 'age': 18, "Ledaddress": "天天超市"}
print("address" in demo_dict)
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/Fate_ZTC/python_study.git
[email protected]:Fate_ZTC/python_study.git
Fate_ZTC
python_study
python_study
master

搜索帮助