create or replace procedure PROC_test is --Description:删除字段中的指定字符(回车chr(13).换行chr(10)) --By LiChao --Date:2016-03-01 colname ); --列名 cnt number; --包含换行符的列的行数 v_sql ); --动态SQL变量 begin --读取表中的列 for col in (select column_name from user_tab_columns where
def stripFile(oldFile, newFile): '''remove the space or Tab or enter in a file, and output a new file in the same folder''' f = open(oldFile, 'r+', encoding='utf8') newf = open(newFile, 'w',encoding='utf8') for eachline in f.readlines(): newStr = eac
将文本中的 tasting123删除 with open("fileread.txt","r",encoding="utf-8") as f: lines = f.readlines() #print(lines) with open("fileread.txt","w",encoding="utf-8") as f_w: for line in lines: if "tast
list1 = [[], [], [], [], [], 'text', 'text2', [], 'moreText'] 如何删除空列表,以便我得到: list2 = ['text', 'text2', 'moreText'] list2 = [x for x in list1 if x != []] 如果你想摆脱一切"伪造",例如空字符串,空元组,零,你也可以使用 list2 = [x for x in list1 if x] 但在pycharm上不能用 另一种方法:
list = [1,1,3,4,6,3,7] 1. for s in list: if list.count(s) >1: list.remove(s) 2. list2=[] for s in list: if s not in list2: list2.append(s) print list2 3. b = {} b = b.fromkeys(list) print b.keys() 4.set(list)