Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data types
#2
Quote:My question is what data type is .split(' '), i am using python. Any help would be appreciated.

It's not data type but a string method,can also be called build function.
The string methods is used on datatype str(string).
>>> s = 'hello world'
>>> type(s)
<class 'str'>
>>> s.split()
['hello', 'world']
>>> help(s.split)
Help on built-in function split:

split(...) method of builtins.str instance
    S.split(sep=None, maxsplit=-1) -> list of strings
    
    Return a list of the words in S, using sep as the
    delimiter string.  If maxsplit is given, at most maxsplit
    splits are done. If sep is not specified or is None, any
    whitespace string is a separator and empty strings are
    removed from the result.
Reply


Messages In This Thread
Data types - by tahmid909 - Nov-03-2016, 08:21 PM
RE: Data types - by snippsat - Nov-03-2016, 08:37 PM
RE: Data types - by Skaperen - Nov-04-2016, 03:39 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to extract two data types from a text file and store them as two separate lists banf 1 3,539 Jan-16-2017, 09:52 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020