python中的real_Python中基本数据类型的学习

1 classstr(object):2 """

3 str(object='') -> str4 str(bytes_or_buffer[, encoding[, errors]]) -> str5

6 Create a new string object from the given object. If encoding or7 errors is specified, then the object must expose a data buffer8 that will be decoded using the given encoding and error handler.9 Otherwise, returns the result of object.__str__() (if defined)10 or repr(object).11 encoding defaults to sys.getdefaultencoding().12 errors defaults to 'strict'.13 """

14 def capitalize(self): #real signature unknown; restored from __doc__

15 """首字母大写其他的全部小写"""

16 """

17 S.capitalize() -> str18

19 Return a capitalized version of S, i.e. make the first character20 have upper case and the rest lower case.21 """

22 return ""

23

24 def casefold(self): #real signature unknown; restored from __doc__

25 """所有字符小写(比更加牛能把很多未知的对应变小写)"""

26 """

27 S.casefold() -> str28

29 Return a version of S suitable for caseless comparisons.30 """

31 return ""

32

33 def center(self, width, fillchar=None): #real signature unknown; restored from __doc__

34 """字符居中; width:总长度 ; fillchar:空白处填内容 默认无"""

35 """

36 S.center(width[, fillchar]) -> str37

38 Return S centered in a string of length width. Padding is39 done using the specified fill character (default is a space)40 """

41 return ""

42

43 def count(self, sub, start=None, end=None): #real signature unknown; restored from __doc__

44 """计算出字符串sub参数在出现几次, start:起始位置;end:结束位置"""

45 """

46 S.count(sub[, start[, end]]) -> int47

48 Return the number of non-overlapping occurrences of substring sub in49 string S[start:end]. Optional arguments start and end are50 interpreted as in slice notation.51 """

52 return053

54 def endswith(self, suffix, start=None, end=None): #real signature unknown; restored from __doc__

55 """判断是否以suffix参数结尾 start:起始位置;end结束位置"""

56 """

57 S.endswith(suffix[, start[, end]]) -> bool58

59 Return True if S ends with the specified suffix, False otherwise.60 With optional start, test S beginning at that position.61 With optional end, stop comparing S at that position.62 suffix can also be a tuple of strings to try.63 """

64 returnFalse65

66 def expandtabs(self, tabsize=8): #real signature unknown; restored from __doc__

67 """以tabsize参数分割字符串,遇到'\t'不足的用空格补齐"""

68 """

69 S.expandtabs(tabsize=8) -> str70

71 Return a copy of S where all tab characters are expanded using spaces.72 If tabsize is not given, a tab size of 8 characters is assumed.73 """

74 return ""

75

76 def find(self, sub, start=None, end=None): #real signature unknown; restored from __doc__

77 """寻找子序列,找到第一个返回位置,找不到返回-1"""

78 """

79 S.find(sub[, start[, end]]) -> int80

81 Return the lowest index in S where substring sub is found,82 such that sub is contained within S[start:end]. Optional83 arguments start and end are interpreted as in slice notation.84

85 Return -1 on failure.86 """

87 return088

89 def format(*args, **kwargs): #known special case of str.format

90 """字符串插入,动态参数,第一个参数列表形式,第二个传入字典"""

91 """

92 S.format(*args, **kwargs) -> str93

94 Return a formatted version of S, using substitutions from args and kwargs.95 The substitutions are identified by braces ('{' and '}').96 """

97 pass

98

99 def format_map(self, mapping): #real signature unknown; restored from __doc__

100 """传入格式为字典形式的"""

101 """

102 S.format_map(mapping) -> str103

104 Return a formatted version of S, using substitutions from mapping.105 The substitutions are identified by braces ('{' and '}').106 """

107 return ""

108

109 def index(self, sub, start=None, end=None): #real signature unknown; restored from __doc__

110 """和find一样寻找子序列位置,但没找到会报错,"""

111 """

112 S.index(sub[, start[, end]]) -> int113

114 Like S.find() but raise ValueError when the substring is not found.115 """

116 return0117

118 def isalnum(self): #real signature unknown; restored from __doc__

119 """判断是否只有数字和字符 是返回true,否则返回false"""

120 """

121 S.isalnum() -> bool122

123 Return True if all characters in S are alphanumeric124 and there is at least one character in S, False otherwise.125 """

126 returnFalse127

128 def isalpha(self): #real signature unknown; restored from __doc__

129 """判断是否只有字符 是返回true,否则返回false"""

130 """

131 S.isalpha() -> bool132

133 Return True if all characters in S are alphabetic134 and there is at least one character in S, False otherwise.135 """

136 returnFalse137

138 def isdecimal(self): #real signature unknown; restored from __doc__

139 """判断是否是数字(实际中用的更多) 是返回true,否则返回false"""

140 """

141 S.isdecimal() -> bool142

143 Return True if there are only decimal characters in S,144 False otherwise.145 """

146 returnFalse147

148 def isdigit(self): #real signature unknown; restored from __doc__

149 """判断是否是数字(比上面支持的种类多,不支持中文如二) 是返回true,否则返回false"""

150 """

151 S.isdigit() -> bool152

153 Return True if all characters in S are digits154 and there is at least one character in S, False otherwise.155 """

156 returnFalse157

158 def isidentifier(self): #real signature unknown; restored from __doc__

159 """是否符合变量的书写方式"""

160 """

161 S.isidentifier() -> bool162

163 Return True if S is a valid identifier according164 to the language definition.165

166 Use keyword.iskeyword() to test for reserved identifiers167 such as "def" and "class".168 """

169 returnFalse170

171 def islower(self): #real signature unknown; restored from __doc__

172 """判断字母是否全是小写"""

173 """

174 S.islower() -> bool175

176 Return True if all cased characters in S are lowercase and there is177 at least one cased character in S, False otherwise.178 """

179 returnFalse180

181 def isnumeric(self): #real signature unknown; restored from __doc__

182 """判断是否是数字(支持更多如中文) 是返回true,否则返回false"""

183 """

184 S.isnumeric() -> bool185

186 Return True if there are only numeric characters in S,187 False otherwise.188 """

189 returnFalse190

191 def isprintable(self): #real signature unknown; restored from __doc__

192 """是否有不可显示的字符串如'\t','\n'"""

193 """

194 S.isprintable() -> bool195

196 Return True if all characters in S are considered197 printable in repr() or S is empty, False otherwise.198 """

199 returnFalse200

201 def isspace(self): #real signature unknown; restored from __doc__

202 """是否全是空格"""

203 """

204 S.isspace() -> bool205

206 Return True if all characters in S are whitespace207 and there is at least one character in S, False otherwise.208 """

209 returnFalse210

211 def istitle(self): #real signature unknown; restored from __doc__

212 """是否是标题形式的如 The Book (首字母大写)"""

213 """

214 S.istitle() -> bool215

216 Return True if S is a titlecased string and there is at least one217 character in S, i.e. upper- and titlecase characters may only218 follow uncased characters and lowercase characters only cased ones.219 Return False otherwise.220 """

221 returnFalse222

223 def isupper(self): #real signature unknown; restored from __doc__

224 """判断字母是否全部是大写"""

225 """

226 S.isupper() -> bool227

228 Return True if all cased characters in S are uppercase and there is229 at least one cased character in S, False otherwise.230 """

231 returnFalse232

233 def join(self, iterable): #real signature unknown; restored from __doc__

234 """将iterable参数中的每个元素按照指定分隔符(调用join的变量)进行拼接"""

235 """

236 S.join(iterable) -> str237

238 Return a string which is the concatenation of the strings in the239 iterable. The separator between elements is S.240 """

241 return ""

242

243 def ljust(self, width, fillchar=None): #real signature unknown; restored from __doc__

244 """将字符串放在左边,用法和center一样"""

245 """

246 S.ljust(width[, fillchar]) -> str247

248 Return S left-justified in a Unicode string of length width. Padding is249 done using the specified fill character (default is a space).250 """

251 return ""

252

253 def lower(self): #real signature unknown; restored from __doc__

254 """将字符串转换成小写"""

255 """

256 S.lower() -> str257

258 Return a copy of the string S converted to lowercase.259 """

260 return ""

261

262 def lstrip(self, chars=None): #real signature unknown; restored from __doc__

263 """去除左边开始chars参数所代表的字符串(包括其子字符串可自由组合),没有不去除,不填默认去除多余空格还有('\t','\]n');"""

264 """

265 S.lstrip([chars]) -> str266

267 Return a copy of the string S with leading whitespace removed.268 If chars is given and not None, remove characters in chars instead.269 """

270 return ""

271

272 def maketrans(self, *args, **kwargs): #real signature unknown

273 """做一个对应关系 如maketrans("abcd','1234') 将'abcvd','1234'一一对应返回,274 调用translate时用到 用后面的替换前面的"""

275 """

276 Return a translation table usable for str.translate().277

278 If there is only one argument, it must be a dictionary mapping Unicode279 ordinals (integers) or characters to Unicode ordinals, strings or None.280 Character keys will be then converted to ordinals.281 If there are two arguments, they must be strings of equal length, and282 in the resulting dictionary, each character in x will be mapped to the283 character at the same position in y. If there is a third argument, it284 must be a string, whose characters will be mapped to None in the result.285 """

286 pass

287

288 def partition(self, sep): #real signature unknown; restored from __doc__

289 """从左边开始找到sep参数相同的字符串开始分割,('xx','sep','xx')"""

290 """

291 S.partition(sep) -> (head, sep, tail)292

293 Search for the separator sep in S, and return the part before it,294 the separator itself, and the part after it. If the separator is not295 found, return S and two empty strings.296 """

297 pass

298

299 def replace(self, old, new, count=None): #real signature unknown; restored from __doc__

300 """用新的代替老的字符串"""

301 """

302 S.replace(old, new[, count]) -> str303

304 Return a copy of S with all occurrences of substring305 old replaced by new. If the optional argument count is306 given, only the first count occurrences are replaced.307 """

308 return ""

309

310 def rfind(self, sub, start=None, end=None): #real signature unknown; restored from __doc__

311 """和find一样,但是从右边开始寻找"""

312 """

313 S.rfind(sub[, start[, end]]) -> int314

315 Return the highest index in S where substring sub is found,316 such that sub is contained within S[start:end]. Optional317 arguments start and end are interpreted as in slice notation.318

319 Return -1 on failure.320 """

321 return0322

323 def rindex(self, sub, start=None, end=None): #real signature unknown; restored from __doc__

324 """和index一样, 但是从右边开始寻找"""

325 """

326 S.rindex(sub[, start[, end]]) -> int327

328 Like S.rfind() but raise ValueError when the substring is not found.329 """

330 return0331

332 def rjust(self, width, fillchar=None): #real signature unknown; restored from __doc__

333 """将字符串放在右边,用法和center一样"""

334 """

335 S.rjust(width[, fillchar]) -> str336

337 Return S right-justified in a string of length width. Padding is338 done using the specified fill character (default is a space).339 """

340 return ""

341

342 def rpartition(self, sep): #real signature unknown; restored from __doc__

343 """从右边开始找到sep参数相同的字符串开始分割,('xx','sep','xx')"""

344 """

345 S.rpartition(sep) -> (head, sep, tail)346

347 Search for the separator sep in S, starting at the end of S, and return348 the part before it, the separator itself, and the part after it. If the349 separator is not found, return two empty strings and S.350 """

351 pass

352

353 def rsplit(self, sep=None, maxsplit=-1): #real signature unknown; restored from __doc__

354 """从右边开始找到sep参数相同的字符串开始分割,分割时去掉sep;maxsplit:代表找几次;('xx','xx')"""

355 """

356 S.rsplit(sep=None, maxsplit=-1) -> list of strings357

358 Return a list of the words in S, using sep as the359 delimiter string, starting at the end of the string and360 working to the front. If maxsplit is given, at most maxsplit361 splits are done. If sep is not specified, any whitespace string362 is a separator.363 """

364 return[]365

366 def rstrip(self, chars=None): #real signature unknown; restored from __doc__

367 """去除右边开始chars参数所代表的字符串(包括其子字符串可自由组合),没有不去除(只有前一个去了后面才能去),368 不填默认去除多余空格还有('\t','\]n');"""

369 """

370 S.rstrip([chars]) -> str371

372 Return a copy of the string S with trailing whitespace removed.373 If chars is given and not None, remove characters in chars instead.374 """

375 return ""

376

377 def split(self, sep=None, maxsplit=-1): #real signature unknown; restored from __doc__

378 """从左边开始找到sep参数相同的字符串开始分割,分割时去掉sep;maxsplit:代表找几次;('xx','xx')"""

379 """

380 S.split(sep=None, maxsplit=-1) -> list of strings381

382 Return a list of the words in S, using sep as the383 delimiter string. If maxsplit is given, at most maxsplit384 splits are done. If sep is not specified or is None, any385 whitespace string is a separator and empty strings are386 removed from the result.387 """

388 return[]389

390 def splitlines(self, keepends=None): #real signature unknown; restored from __doc__

391 """分割,按照'\n'分割,keepends:true保留换行符,false不保留换行符"""

392 """

393 S.splitlines([keepends]) -> list of strings394

395 Return a list of the lines in S, breaking at line boundaries.396 Line breaks are not included in the resulting list unless keepends397 is given and true.398 """

399 return[]400

401 def startswith(self, prefix, start=None, end=None): #real signature unknown; restored from __doc__

402 """判断是否以prefix参数开头 start:起始位置;end结束位置"""

403 """

404 S.startswith(prefix[, start[, end]]) -> bool405

406 Return True if S starts with the specified prefix, False otherwise.407 With optional start, test S beginning at that position.408 With optional end, stop comparing S at that position.409 prefix can also be a tuple of strings to try.410 """

411 returnFalse412

413 def strip(self, chars=None): #real signature unknown; restored from __doc__

414 """去除两边开始chars参数所代表的字符串(包括其子字符串可自由组合),没有不去除(只有前一个去了后面才能去),415 不填默认去除多余空格还有('\t','\]n');"""

416 """

417 S.strip([chars]) -> str418

419 Return a copy of the string S with leading and trailing420 whitespace removed.421 If chars is given and not None, remove characters in chars instead.422 """

423 return ""

424

425 def swapcase(self): #real signature unknown; restored from __doc__

426 """大小写转换"""

427 """

428 S.swapcase() -> str429

430 Return a copy of S with uppercase characters converted to lowercase431 and vice versa.432 """

433 return ""

434

435 def title(self): #real signature unknown; restored from __doc__

436 """将字符串转换成标题形式"""

437 """

438 S.title() -> str439

440 Return a titlecased version of S, i.e. words start with title case441 characters, all remaining cased characters have lower case.442 """

443 return ""

444

445 def translate(self, table): #real signature unknown; restored from __doc__

446 """按照table参数表示的一一对应关系替换 变量中的值 ,返回替换后的字符串"""

447 """

448 S.translate(table) -> str449

450 Return a copy of the string S in which each character has been mapped451 through the given translation table. The table must implement452 lookup/indexing via __getitem__, for instance a dictionary or list,453 mapping Unicode ordinals to Unicode ordinals, strings, or None. If454 this operation raises LookupError, the character is left untouched.455 Characters mapped to None are deleted.456 """

457 return ""

458

459 def upper(self): #real signature unknown; restored from __doc__

460 """将字符串中字母全部变成大写"""

461 """

462 S.upper() -> str463

464 Return a copy of S converted to uppercase.465 """

466 return ""

467

468 def zfill(self, width): #real signature unknown; restored from __doc__

469 """将字符串放在右边和 width:代表宽度 ;默认用0填充"""

470 """

471 S.zfill(width) -> str472

473 Pad a numeric string S with zeros on the left, to fill a field474 of the specified width. The string S is never truncated.475 """

476 return ""

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值