原创 Python我的模塊—創建目錄,成功返回true,失敗返回False

#創建目錄,成功返回true,失敗返回False def mkdir(pathparam):     # 去除空格     pathname="".join(pathparam.split())     # 去除尾部 \ 符號     p

原创 Python我的模塊-平均分配list數據到4個list中

#平均分配list數據到4個list中 def ave_test():     #list1 = [[1,2]]     #list1 = [[1,2],[3,4]]     #list1 = [[1,2],[3,4],[5,6]]  

原创 Python我的模塊-字符串截取(截取字符串的後n個數)

#字符串截取,返回最大長度爲sub_str_max_len的子串 #截取後sub_str_max_len個數 def last_substr(str_param,sub_str_max_len):     resstr = str_par

原创 Python我的模塊-獲取子串(split妙用)

#獲取子串 def get_sub_title(strparam):     fname=''     name_end = strparam.find('—2019')     if name_end >1:         fname

原创 Python我的模塊-比較兩個字符串,找出一個在另一箇中不存在的項

# -*- coding: utf-8 -*- #!/usr/bin/python3 #比較兩個字符串,找出一個在另一箇中不存在的項,而且,在另外一箇中是模糊匹配。 #例如,[‘aa'] 在 ['aab'],屬於存在。 def compa

原创 Python我的模塊-字符替換

#Python我的模塊-字符替換 def replace_str():     t1 = "2019年12月18日15:00"     t1 = t1.replace(":", "_");     print("t1")     prin

原创 Python我的模塊—獲取當前時間的最後4位數

#根據時間戳獲取隨機數,如果參數is_fulltime 爲true,就獲取整個時間戳,且將"."轉化爲“_”;否則,只獲取當前時間的最後4位。 def get_time_random(is_fulltime):     res_title

原创 "Android resource linking failed"問題解決

1. 問題log: Android resource linking failed /Users/user1/app/build/intermediates/incremental/mergeDebugResources/merged.d

原创 Android編程注意事項(不斷更新中)

1. =======不要再子線程中更新ui,不要再子線程中調用toast,例如: private void loadData() { if (isRunningFindTask) { //下面這

原创 利用Putty遠程登錄VMware虛擬機Ubuntu

安裝SSH服務 Ubuntu默認並沒有安裝ssh服務,如果通過ssh鏈接ubuntu,需要自己手動安裝ssh-server。判斷是否安裝ssh服務,可以通過如下命令進行: ~$ ssh localhost     ssh: connect

原创 python基礎--Python模塊(import, from import)

程序清單: #support.py 模塊:def print_func( par ):    print(par)    return     #test_main.py:import support support.print_func

原创 python基礎--函數6時間和日期函數(time,calendar)

測試代碼: 1. time測試代碼 import time;  # 引入time模塊   t1= time.time() print(t1) t2 = time.localtime(time.time()) print(t2) t3 =

原创 python基礎--函數1(abs,max,min,int,str,float,bool,bytes)

測試代碼: #abs,max,min,int,str,float,bool,bytes >>> abs(-10) 10 >>> max(1,6,3) 6 >>> min(1,6,3) 1 >>> int(r) Traceback (mos

原创 python基礎--循環控制語句break 和 continue

程序清單: # do_break_continue.py print('break test:') n = 1 while n <= 100:     if n > 10: # 當n = 11時,條件滿足,執行break語句      

原创 python基礎--函數3(all,any)

測試代碼: #all,any >>> slist=['c','java'] >>> all(slist) True >>> slist2=[] >>> all(slist2) True >>> slist3=[0] >>> all(sli