Coder Social home page Coder Social logo

show-me-the-code / python Goto Github PK

View Code? Open in Web Editor NEW
3.8K 3.8K 2.7K 108.15 MB

Show Me the Code Python version.

Home Page: https://github.com/Show-Me-the-Code/show-me-the-code

License: MIT License

Python 27.05% HTML 56.91% CSS 0.16% C 0.18% JavaScript 0.25% Mako 0.02% C++ 0.26% Jupyter Notebook 15.17% Java 0.01%

python's Introduction

Python 练习册,每天一个小程序

说明:

  • Python 练习册,每天一个小程序。注:将 Python 换成其他语言,大多数题目也适用
  • 不会出现诸如「打印九九乘法表」、「打印水仙花」之类的题目
  • 本文本文由@史江歌([email protected] QQ:499065469)根据互联网资料收集整理而成,感谢互联网,感谢各位的分享。鸣谢!本文会不断更新。
  • 欢迎大家 Pull Request 出题目,贴代码(Gist、Blog皆可):-)
  • 欢迎解答, 并发送 pull request 到 Show-Me-the-Code

Talk is cheap. Show me the code.--Linus Torvalds


**第 0000 题:**将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。 类似于图中效果

头像

第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?

第 0002 题:将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。

**第 0003 题:**将 0001 题生成的 200 个激活码(或者优惠券)保存到 Redis 非关系型数据库中。

**第 0004 题:**任一个英文的纯文本文件,统计其中的单词出现的个数。

**第 0005 题:**你有一个目录,装了很多照片,把它们的尺寸变成都不大于 iPhone5 分辨率的大小。

**第 0006 题:**你有一个目录,放了你一个月的日记,都是 txt,为了避免分词的问题,假设内容都是英文,请统计出你认为每篇日记最重要的词。

**第 0007 题:**有个目录,里面是你自己写过的程序,统计一下你写过多少行代码。包括空行和注释,但是要分别列出来。

第 0008 题:一个HTML文件,找出里面的正文

第 0009 题:一个HTML文件,找出里面的链接

第 0010 题:使用 Python 生成类似于下图中的字母验证码图片

字母验证码

第 0011 题: 敏感词文本文件 filtered_words.txt,里面的内容为以下内容,当用户输入敏感词语时,则打印出 Freedom,否则打印出 Human Rights。

北京
程序员
公务员
领导
牛比
牛逼
你娘
你妈
love
sex
jiangge

第 0012 题: 敏感词文本文件 filtered_words.txt,里面的内容 和 0011题一样,当用户输入敏感词语,则用 星号 * 替换,例如当用户输入「北京是个好城市」,则变成「**是个好城市」。

第 0013 题: 用 Python 写一个爬图片的程序,爬 这个链接里的日本妹子图片 :-)

第 0014 题: 纯文本文件 student.txt为学生信息, 里面的内容(包括花括号)如下所示:

{
	"1":["张三",150,120,100],
	"2":["李四",90,99,95],
	"3":["王五",60,66,68]
}

请将上述内容写到 student.xls 文件中,如下图所示:

student.xls

  • 阅读资料 腾讯游戏开发 XML 和 Excel 内容相互转换

第 0015 题: 纯文本文件 city.txt为城市信息, 里面的内容(包括花括号)如下所示:

{
    "1" : "上海",
    "2" : "北京",
    "3" : "成都"
}

请将上述内容写到 city.xls 文件中,如下图所示:

city.xls

第 0016 题: 纯文本文件 numbers.txt, 里面的内容(包括方括号)如下所示:

[
	[1, 82, 65535],
	[20, 90, 13],
	[26, 809, 1024]
]

请将上述内容写到 numbers.xls 文件中,如下图所示:

numbers.xls

第 0017 题: 将 第 0014 题中的 student.xls 文件中的内容写到 student.xml 文件中,如

下所示:

<?xml version="1.0" encoding="UTF-8"?>
<root>
<students>
<!--
	学生信息表
	"id" : [名字, 数学, 语文, 英文]
-->
{
	"1" : ["张三", 150, 120, 100],
	"2" : ["李四", 90, 99, 95],
	"3" : ["王五", 60, 66, 68]
}
</students>
</root>
  • 阅读资料 腾讯游戏开发 xml 和 Excel 相互转换

第 0018 题: 将 第 0015 题中的 city.xls 文件中的内容写到 city.xml 文件中,如下所示:

<?xmlversion="1.0" encoding="UTF-8"?>
<root>
<citys>
<!--
	城市信息
-->
{
	"1" : "上海",
	"2" : "北京",
	"3" : "成都"
}
</citys>
</root>

第 0019 题: 将 第 0016 题中的 numbers.xls 文件中的内容写到 numbers.xml 文件中,如下

所示:

<?xml version="1.0" encoding="UTF-8"?>
<root>
<numbers>
<!--
	数字信息
-->

[
	[1, 82, 65535],
	[20, 90, 13],
	[26, 809, 1024]
]

</numbers>
</root>

第 0020 题: 登陆中国联通网上营业厅 后选择「自助服务」 --> 「详单查询」,然后选择你要查询的时间段,点击「查询」按钮,查询结果页面的最下方,点击「导出」,就会生成类似于 2014年10月01日~2014年10月31日通话详单.xls 文件。写代码,对每月通话时间做个统计。

第 0021 题: 通常,登陆某个网站或者 APP,需要使用用户名和密码。密码是如何加密后存储起来的呢?请使用 Python 对密码加密。

第 0022 题: iPhone 6、iPhone 6 Plus 早已上市开卖。请查看你写得 第 0005 题的代码是否可以复用。

第 0023 题: 使用 Python 的 Web 框架,做一个 Web 版本 留言簿 应用。

阅读资料:Python 有哪些 Web 框架

  • 留言簿参考

第 0024 题: 使用 Python 的 Web 框架,做一个 Web 版本 TodoList 应用。

  • SpringSide 版TodoList

第 0025 题: 使用 Python 实现:对着电脑吼一声,自动打开浏览器中的默认网站。

例如,对着笔记本电脑吼一声“百度”,浏览器自动打开百度首页。

关键字:Speech to Text

参考思路: 1:获取电脑录音-->WAV文件 python record wav

2:录音文件-->文本

STT: Speech to Text

STT API Google API

3:文本-->电脑命令

python's People

Contributors

bramblexu avatar cailurus avatar chris5641 avatar ddkangfu avatar diygod avatar drake-z avatar friday21 avatar goldbrown avatar horx avatar houshengandt avatar howel52 avatar jaccorot avatar jiangqideng avatar jiyoumcc avatar kxrr avatar llapuras avatar llluiop avatar lupino avatar lwhile avatar monkey-soft avatar ncw1992120 avatar razzl avatar robot527 avatar silocean avatar starlightme avatar vvzwvv avatar xieyajie avatar xkoko123 avatar yixiaohan avatar zeyue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python's Issues

(please help) having problem in my code

Description of the Bug

1.Hi Developers im new to coding. i tried to make this video uploading app to my firebase storage but im not that good at coding so im stuck at this problem. when upload button is pressed the filechooser is opened and if i select a file it gets uploaded to the firebase But if i cancel and close the filechooser it gives an error.
2. i am unaware if this file chooser works on android or nor...if it does not please help me with this code too. im stuck on this since 6 January ,thats how poor i am.

Code

from kivy.app import App
from kivy.lang import Builder

kv = '''
<MainScreen>:
    name: 'mainscreen'
    MDLabel:
        id:username_info
        text:'Hello Main'
        font_style:'H1'
        halign:'center'

    MDFloatLayout:
        id:floate
        Video:
            id:vid

        MDToolbar:
            title: 'Bottom navigation'
            md_bg_color: .2, .2, .2, 1
            specific_text_color: 1, 1, 1, 1
        MDBottomNavigation:
            panel_color: 1,1,1,1
            MDBottomNavigationItem:
                name: 'screen 1'
                text: 'Home'
                icon: 'home-outline'
                MDRaisedButton:
                    id:upload
                    text:'Upload'
                    pos_hint:{'center_x':.5, 'center_y':.4}
                    on_release:
                        app.file_chooser()
                        upload.disabled=False
'''


class goodApp(MDApp):

    def build(self):
        self.strng = Builder.load_string(help_str)
        self.url  = "link.json"
        return self.strng

    def file_chooser(self):
        filechooser.open_file(on_selection=self.selected)        
    def selected(self,selection):
        config={
              'Api keys of firebase'
        }

        firebase=pyrebase.initialize_app(config)
        storage=firebase.storage()            
        Directory=selection[0]
        Name=re.findall('[ \w-]+\..*',Directory)
        loginEmail = self.strng.get_screen('loginscreen').ids.login_email.text
        storage.child(str(f"{loginEmail}")).child(str(f"{Name}")).put(str(f"{Name[0]}"))

        if selection==True:
            self.root.ids.vid.source=firebase
            self.strng.get_screen('mainscreen').ids.upload.disabled=True
            self.strng.get_screen('mainscreen').manager.current ='uploadscreen'
            self.strng.get_screen('mainscreen').manager.transition.direction='left'            

        if selection==False:
            self.strng.get_screen('mainscreen').ids.upload.disabled=False



if __name__ == '__main__':
    goodApp().run()

Logs

[INFO ] [Logger ] Record log in C:\Users\Dheeraj.kivy\logs\kivy_22-01-19_1.txt
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.3.0
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.0
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.3.1
[INFO ] [Kivy ] v2.0.0
[INFO ] [Kivy ] Installed at "C:\Users\Dheeraj\AppData\Roaming\Python\Python38\site-packages\kivy_init_.py"
[INFO ] [Python ] v3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "C:\Users\Dheeraj\AppData\Local\Programs\Python\Python38\pythonw.exe"
[INFO ] [Factory ] 186 symbols loaded
[INFO ] [KivyMD ] 0.104.2, git-bc7d1f5, 2021-06-06 (installed at "C:\Users\Dheeraj\AppData\Local\Programs\Python\Python38\lib\site-packages\kivymd_init_.py")
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used
[INFO ] [GL ] OpenGL version <b'2.1 Mesa 10.0.2 (git-675cd84)'>
[INFO ] [GL ] OpenGL vendor <b'VMware, Inc.'>
[INFO ] [GL ] OpenGL renderer <b'Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits)'>
[INFO ] [GL ] OpenGL parsed version: 2, 1
[INFO ] [GL ] Shading version <b'1.30'>
[INFO ] [GL ] Texture max size <8192>
[INFO ] [GL ] Texture max units <16>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [KivMob ] init called.
[WARNING] [KivMob ] Ads will not be shown.
[INFO ] [GL ] NPOT texture support is available
[INFO ] [Video ] Provider: null(['video_ffmpeg', 'video_ffpyplayer'] ignored)
[INFO ] [Base ] Start application main loop
Traceback (most recent call last):
File "C:\Users\Dheeraj\AppData\Roaming\Python\Python38\site-packages\plyer\platforms\win\filechooser.py", line 102, in run
self.fname, _, _ = win32gui.GetOpenFileNameW(**args)
pywintypes.error: (0, 'GetOpenFileNameW', 'No error message is available')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Dheeraj\AppData\Roaming\Python\Python38\site-packages\plyer\platforms\win\filechooser.py", line 108, in run
self._handle_selection(self.selection)
File "C:\Users\Dheeraj\Desktop\kivy codes\priyanshu doraming\Magenta.py", line 949, in selected
Directory=selection[0]
IndexError: list index out of range
[INFO ] [Base ] Leaving application in progress...

Screenshots

Add images to explain us this bug. Paste urls here.

Remove this section if no images here

Versions

  • OS: win 7 pro
  • Python: 3.7
  • Kivy: latest
  • KivyMD: latest (update everyweek)

Conditionals

Please can you help solve this in Python and explain to me

mystery_int_1 = 7
mystery_int_2 = 2

You may modify the lines of code above, but don't move them! When you Submit your code, we'll change these lines to assign different values to the variables.

The variables below hold two integers, mystery_int_1 and
mystery_int_2. Complete this program below such that it
prints "Factors!" if either of the numbers is a factor of the other. If neither number is a factor of the other, do not print anything.

Hint: You can do this with just one conditional statement
by using the logical expressions (and, or, and not). You'll also use the modulus operator

Please help me with the Add your code here!

Have tried several means am just not getting it

Create a program that Ping a list of IP

Hi,
Im new in this coding field
im trying to create a program that Ping a list of IPs that i have on a text file and saves the output result into another textfile
, but im not able to do it

the code that i use is this one

`import subprocess

with open('ip2.txt' ,encoding="utf-8") as f,open('ip_out.txt', 'wb') as f_out:
for adress in f:
adress = adress.strip()
response = subprocess.run(['ping', adress], capture_output=True)
print(response.stdout.decode())
f_out.write(response.stdout)`

An AI program

I wanted a code of ai program like jarvis alexa or Google assistant siri but which can program as to help me

Code to add two numbers

Please is this the right python code to add two numbers

x = input("Type a number: ")
y = input("Type another number: ")

sum = int(x) + int(y)

print("The sum is: ", sum)

UPDATE THE README FILE

Hey there, can't find any relevant project description in the README file. I can follow the codes but its deja-vu. kindly help.

P

Error

repo太大了,clone好慢

git clone要100多兆,应该主要是图片吧,建议把图片都删掉,gitignore最好也配置下,过滤掉图片。

关于这个仓库

题目很棒!

建议把题目分个类

感觉交流有点少,通过题目应该有交流的地方,github上的python社区:)

以上只是个人看法.jk :w

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.