python学习
zydapangzi
还是菜鸟,需要努力
展开
-
leetcode题目11. Container With Most Water
leetcode题目11. Container With Most WaterNote:Example:CODE: #题目简介 Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that ...原创 2019-04-14 15:03:44 · 130 阅读 · 0 评论 -
leetcode题目-12. Integer to Roman
题目介绍 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, two is written as II in R...原创 2019-04-15 20:07:59 · 117 阅读 · 0 评论 -
python中常见的错误(转)
在学习过程中,偶然发现一个博客,写的关于python中常见的10个错误,觉得比较不错,整理一下。 原文见: http://bookshadow.com/weblog/2014/05/14/top-10-mistakes-that-python-programmers-make/ 具体如下: 1:函数参数默认值表达式的误用 def fun(friut=[]): friut.app...转载 2019-03-30 16:28:40 · 194 阅读 · 0 评论 -
python中的内建函数-*attr()
在学习python的面向对象编程时,获取对象的某个属性时,可以使用*attr()函数来进行相应操作,免去了编写get方法。 *attr()具体如下: hasattr(object, name) # 为了确定object对象有无name属性 getattr(object, name) # 获得该属性的值 setattr(object, name, value...原创 2019-03-25 16:29:40 · 729 阅读 · 0 评论 -
leetcode题目-8.String to Integer (atoi)
题目介绍:Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting fro...原创 2019-02-19 20:19:56 · 94 阅读 · 0 评论 -
python知识点
1:三元表达式 flag = 1 if something else 0 如果something成立,flag为1,否则为0. 2:字符串中的一些操作: s = 'b982La jsDaz' print s.lower() # b982la jsdaz 全部转小写 print s.upper() #B982LA JSDAZ 全部转大写 print s.titl...原创 2019-02-19 17:27:29 · 91 阅读 · 0 评论 -
leetcode题目-9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Expl...原创 2019-02-22 16:37:53 · 83 阅读 · 0 评论 -
leetcode题目3---Longest Substring Without Repeating Characters
题目描述: Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Exam...原创 2019-01-31 11:37:48 · 134 阅读 · 0 评论 -
leetcode题目-5. Longest Palindromic Substring
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Exa...原创 2019-02-16 15:43:28 · 106 阅读 · 0 评论 -
leetcode题目一Two Sum
1.Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the sam...原创 2019-01-24 17:28:58 · 139 阅读 · 0 评论 -
py文件打包成exe以及pip安装whl文件出现的问题
环境 本地python版本为:3.7.3 自带pip 需要下载pyinstaller 可使用pip install pyinstaller 打包 只包含基础库的py可以直接使用,在cmd中执行:pyinstaller -F py文件路径 若包含第三方库。执行pyinstaller命令时,需要加-p参数来添加第三方库的路径,通过pip安装的第三方库,都在本地python的python\Lib\si...原创 2019-05-21 11:29:30 · 533 阅读 · 3 评论