teleren/devto huggingface dataset:
Python String split()
Tags: python, programming, codenewbie, tutorial
Published: 2022-01-25 16:10:42

---
title: Python String split()
published: true
date: 2022-01-23 08:00:45 UTC
tags: #python #programming #codenewbie #tutorial
canonical_url: https://itsmycode.com/python-string-split/
---

The **Python String split()** method is a built-in function that splits the string based on the specified separator and returns a list of strings.

Also read How to Fix [ValueError: If using all scalar values, you must pass an index](https://itsmycode.com/valueerror-if-using-all-scalar-values-you-must-pass-an-index/)


In this article, we will learn about the **Python String `split()`** method with the help of examples.

## split() Syntax

The Syntax of **`split()`** method is:

```python 
str.split(separator, maxsplit)
```

## split() Parameters

The **`split()`** method takes two parameters, and both are optional.

- **separator (optional) –** Delimiter at which the string split should happen. If not provided, whitespace is taken as a separator, and the string will split at whitespaces. 
- **maxsplit (optional) –** An integer that tells us the maximum number of times the split should happen. If not provided, the default value is `-1`, which means there is no limit on the number of splits.

**Example –** If you would like to split the string on the occurrences of the first comma, you can set the `maxsplit=1`

The `maxsplit=1` will split the string into 2 chunks—one with the string section before the first comma and another with the string section after the first comma. 

## split() Return Value

The **`split()`** method returns the list of strings after breaking the given string by the specified character.

## Example 1: How split() works in Python?

```python 
# splits by whitespace
text = "Python is fun"
print(text.split())

# splits the text after 'is' string
text = "Python is fun"
print(text.split('is'))

# cannot split as the character is not found
text = "Python is fun"
print(text.split('|'))

# splits by comma
fruits ="Apple, Grapes, Orange, Watermelon"
print(fruits.split(','))
```

**Output**

```python 
['Python', 'is', 'fun']
['Python ', ' fun']
['Python is fun']
['Apple', ' Grapes', ' Orange', ' Watermelon']
```

## Example 2: How split() works when maxsplit is specified?

```python 
# splits by whitespace
text = "Python is really fun"
print(text.split(' ', 1))

# splits by comma
fruits = "Apple, Grapes, Orange, Watermelon"
print(fruits.split(',', 0))

# splits by comma
fruits = "Apple, Grapes, Orange, Watermelon"
print(fruits.split(',', 1))

# splits by comma
fruits = "Apple, Grapes, Orange, Watermelon"
print(fruits.split(',', 2))

# splits by comma
fruits = "Apple, Grapes, Orange, Watermelon"
print(fruits.split(',', 3))

```

**Output**

```python 
['Python', 'is really fun']
['Apple, Grapes, Orange, Watermelon']
['Apple', ' Grapes, Orange, Watermelon']
['Apple', ' Grapes', ' Orange, Watermelon']
['Apple', ' Grapes', ' Orange', ' Watermelon']
```
Python String rsplit()
Tags: python, programming, codenewbie, tutorial
Published: 2022-01-25 16:09:31

---
title: Python String rsplit()
published: true
date: 2022-01-23 07:57:19 UTC
tags: #python #programming #codenewbie #tutorial
canonical_url: https://itsmycode.com/python-string-rsplit/
---

The **Python String rsplit()** method is a built-in function that splits the string at the specified separator from the right side and returns a list of strings.

Also read How to fix [Pandas TypeError: no numeric data to plot](https://itsmycode.com/solved-pandas-typeerror-no-numeric-data-to-plot/)

In this article, we will learn about the **Python String `rsplit()`** method with the help of examples.

## rsplit() Syntax

The Syntax of **`rsplit()`** method is:

```Python 
str.rsplit(separator, maxsplit)
```

## rsplit() Parameters

The **`rsplit()`** method takes two parameters, and both are optional.

- **separator (optional) –** Delimiter after which the string split should happen . If not provided, whitespace is taken as a separator, and the string will split at whitespaces. 
- **maxsplit (optional) –** An integer that tells us the maximum number of times the split should happen. If not provided, the default value is -1, which means there is no limit on the number of splits.

## rsplit() Return Value

The **`rsplit()`** method returns the list of strings after breaking the given string at the separator from the right side

Also read How to fix [Python ValueError: Trailing data](https://itsmycode.com/how-to-fix-in-python-valueerror-trailing-data/)

## Example 1: How rsplit() works in Python?

If we do not specify maxsplit to rsplit() method it behaves exactly like split() method as shown in below example.

```Python 
# splits by whitespace
text = "Python is fun"
print(text.rsplit())

# splits the text after 'is' string
text = "Python is fun"
print(text.rsplit('is'))

# cannot split as the character is not found
text = "Python is fun"
print(text.rsplit('|'))

# splits by comma
fruits ="Apple, Grapes, Orange, Watermelon"
print(fruits.rsplit(','))

```

**Output**

```Python 
['Python', 'is', 'fun']
['Python ', ' fun']
['Python is fun']
['Apple', ' Grapes', ' Orange', ' Watermelon']
```

## Example 2: How split() works when maxsplit is specified?

```Python 
# splits by whitespace
text = "Python is really fun"
print(text.rsplit(' ', 1))

# splits by comma
fruits = "Apple, Grapes, Orange, Watermelon"
print(fruits.rsplit(',', 0))

# splits by comma
fruits = "Apple, Grapes, Orange, Watermelon"
print(fruits.rsplit(',', 1))

# splits by comma
fruits = "Apple, Grapes, Orange, Watermelon"
print(fruits.rsplit(',', 2))

# splits by comma
fruits = "Apple, Grapes, Orange, Watermelon"
print(fruits.rsplit(',', 3))

```

**Output**

```Python 
['Python is really', 'fun']
['Apple, Grapes, Orange, Watermelon']
['Apple, Grapes, Orange', ' Watermelon']
['Apple, Grapes', ' Orange', ' Watermelon']
['Apple', ' Grapes', ' Orange', ' Watermelon']
```
3 Cara untuk Mendapatkan Konsumen yang Lebih Banyak
Tags: bisnis, jualan, tips
Published: 2022-01-23 07:56:25

Semua pebisnis mau menginginkan barang yang mereka jual laku lebih banyak setiap harinya. Tapi, pebisnis melupakan cara bagaimana barang tersebut bisa diminati oleh konsumennya. Pebisnis tidak bisa menjual produk hanya dengan telah memposting jualanya di Instagram, maupun online shop lainnya. Pebisnis juga perlu melakukan hal yang dapat mempengaruhi konsumennya.

Konsumen yang telah terpengaruh, secara otomatis akan membeli barang yang tersebut. Secara garis besar ini dinamakan psikologi berjualan. Dengan pebisnis melakukan hal yang dapat menarik emosional konsumen, maka konsumen akan datang kepada mereka.

Berikut ini tiga cara psikologi berjualan untuk mendapatkan konsumen yang lebih banyak.

**1. Konsumen Membeli Barang sesuai Emosi Mereka**

Pada dasarnya, semua konsumen memiliki alasan untuk membeli suatu produk. Dengan membeli produk tersebut maka konsumen merasakan kepuasan atau hal tertentu yang membuat mereka senang. Dengan mengatahui alasan apa yang dibutuhkan konsumen, maka penjual perlu melakukan hal yang dapat memenuhi kepuasan konsumen.

Seperti memberikan manfaat atau keunggulan dari produk yang Anda jual dan juga yang lainnya. Maka konsumen akan menyadari bahwa barang tersebut memang mereka perlukan. Anda juga harus memberikan manfaat atau keunggulan dengan secara halus tanpa ada paksa. Konsumen pada dasarnya tidak mau diinterupsi atau dipaksa secara terus menerus.

**2. Konsumen akan Mempertimbangkan Produk yang Anda Jual**

Setelah produk Anda jual diketahui oleh Konsumen, maka Konsumen akan melakukan pertimbangan. Hal ini karena tidak hanya Anda yang menjual baranf tersebut. Anda juga perlu melakukan hal yang membuat Konsumen semakin yakin dengan produk yang Anda jual.

Seperti memberikan garansi atau harga termurah dari semua Toko lainnya. Hal ini juga akan menjadi pertimbangan dari konsumen untuk membeli barang yang mereka perlukan dengan Anda. Tidak lupa juga optimalkan market yang berguna sebagai wadah Anda berjulan.

**3. Keputusan Konsumen dalam Membeli Produk Anda**

Setelah konsumen melakukan pertimbangan, maka mereka secara otomatis membeli barang yang Anda jual. Anda sebagai pebisnis harus membuat bagaimana konsumen tersebut dapat kembali lagi membeli produk lainnya yang Anda jual. Anda harus melakukan hal yang dapat membuat konsumen merasakan hal kepuasan, kenyamanan dan kepercayaan.

Seperti menjual produk dengan jujur, Anda bisa memberitahukan dengan konsumen bahwa barang yang Anda jual keadaanya seperti ini. Setelah konsumen mengetahuinya dan meyakinkan barang tersebut untuk dibeli, jangan buat mereka kecewa. Jika konsumen merasa barangnya tersebut sesuai dengan ekspetasi dan Anda memberikan pelayanan dan kepercayaan yang baik, maka konsumen tersebut akan kembali.

Demikian pembahasan mengenai 3 cara agar mendapatkan konsumen yang lebih banyak. Coba lakukan hal yang telah dijelaskan diatas, maka otomatis konsumen Anda akan bertambah dan semakin lebih banyak. Semoga artikel ini bermanfaat untuk kemajuan bisnis Anda.

Source: https://deepta/club
Amazon S3 storage
Published: 2022-01-23 07:56:19

Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.

S3 storage is very useful to create storage bucket and because of amazon platform the interface is very easy to interect with AWS. we can able to create bucket easily and upload some file into the bucket and make it as a public so that everyone can access it. 

and as per my experience AWS is the best platform to expand your knowledge of cloud computing...
Build unique DAO at a low price
Tags: blockchain, web3, opensource
Published: 2022-01-23 07:55:16

So far, most of DAO tools rely on their own minted tokens. And the register cost of each DAO is a little bit expensive to ordinary people. Moreover, DAO will encounter the problem of the total amount of token issuance if it mint its own tokens.
Therefore, this article will recommend a decentralized DAO registrar for you, that is [VORG](https://vorg.io).

[VORG](https://vorg.io) is a decentralized Virtual ORGanization and domain name registrar based on Ethereum. Virtual organization refers to individuals, groups, teams, organizations, companies, etc.
Registering a DAO on [VORG](https://vorg.io) only costs almost 0.02+ ether gas fee. Each DAO is globally exclusive, and since each DAO is associated with an exclusive domain name (except some special name), the domain name is also globally exclusive. You can use the technical tools provided by [VORG](https://vorg.io) to build your own website on your exclusive domain name.

In addition to this, every DAO on [VORG](https://vorg.io) can issue shares publicly. And shares can be additionally issued through capital increase and share expansion.

Of course, DAO also supports transfer. The DAO name resource can also be recycled through bankruptcy. This is a little bit similar to traditional domain name registration.

About how to register, issue shares, and configure dns, you can learn about it in my previous articles [VORG: Decentralized company and domain name registry](https://dev.to/vorg/vorg-decentralized-company-and-domain-name-registry-599a).
Python String title()
Tags: python, programming, codenewbie, tutorial
Published: 2022-01-25 16:07:12

---
title: Python String title()
published: true
date: 2022-01-23 07:44:41 UTC
tags: #python #programming #codenewbie #tutorial
canonical_url: https://itsmycode.com/python-string-title/
---

The **Python String title()** method is a built-in function that returns a string where the first character of each word is uppercase. It is also called a title case string.

Also read How to Fix [AttributeError: ‘numpy.ndarray’ object has no attribute ‘index’](https://itsmycode.com/attributeerror-numpy-ndarray-object-has-no-attribute-index/)


In this article, we will learn about the **Python String `title()`** method with the help of examples.

## title() Syntax

The Syntax of **`title()`** method is:

```python 
str.title()
```

## title() Parameters

The `title()` method does not take any parameters.

## title() Return Value

The **`title()`** method returns the title cased version of a string. The first character of each word in a string is capitalized.

```
**Note:**  The first letter is capitalized if it's a valid letter. In the case of digits or numbers, the conversion to uppercase will not happen.
```

## Example 1: How Python title() works?

```python 
text = "Welcome to python programming, itsmycode"
print(text.title())

text = "5 times 4 is = to 20 "
print(text.title())
```

**Output**

```python 
Welcome To Python Programming, Itsmycode
5 Times 4 Is = To 20 
```

## Example 2: title() method in case of number and apostrophes

The presence of digits or number before the word will not affect the working of the function. The character after the digit is considered as the first character.

In case of apostrophes the `title()` capitalizes the first letter and the letter after apostrophes as well.

```python 
# incase the of numbers or digits at the beginning
text = "20dollars is the cost of Python programming book"
print(text.title())

# in case of apostrophes
text = "it's python's interpreter"
print(text.title())
```

**Output**

```python 
20Dollars Is The Cost Of Python Programming Book
It'S Python'S Interpreter
```
Create Cache Memory using Redis in Express JS
Tags: node, javascript, react, devops
Published: 2022-01-23 07:05:28

hello all developers we create a Redis store to make server to best response to the client. Redis can maximize the response time of fetching data through server like express.

so , Redis is a super fast and efficient in-memory, key–value cache (hashing the data) and store. It’s also known as a data structure server, as the keys can contain strings, lists, sets, hashes and other data structures. keys will be unique.

> npm install redis

```
const redis = require('redis');
//by default port 6379 and host localhost or 127.0.0.1 
const client = redis.createClient();
```

```
const redis = require('redis');
const client = redis.createClient();

client.on('connect', function() {
  console.log('Connected!');
});
```

so make sure you can install redis in your system.

```
const redis = require('redis');
const client = redis.createClient();
const axios = require('axios');
const express = require('express');

const app = express();
const USERS_API = 'Your Api Url';

app.get('/cached-users', async (req, res) => {

    const data=await client.get('users')

  
   try{
      if (data) {
        console.log('Users retrieved from Redis storage');
        res.status(200).send(JSON.parse(data));
      } else {
        axios.get(`${USERS_API}`).then(function (response) {
          const users = response.data;
          //client.setEx('key',seconds,data)
          client.setEx('users', 400, JSON.stringify(users));
          console.log('Users retrieved from the API');
          res.status(200).send(users);
        });
      }
    });
  } catch (err) {
    res.status(500).send({ error: err});
  }
});

const PORT = 5000;
app.listen(PORT, () => {
  console.log(`Server started at port: ${PORT}`);
});
```


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fx21te26cyw2gxlf83zu.png)
Python String isidentifier()
Tags: python, programming, codenewbie, tutorial
Published: 2022-01-25 16:03:32

---
title: Python String isidentifier()
published: true
date: 2022-01-23 07:03:25 UTC
tags: #python #programming #codenewbie #tutorial
canonical_url: https://itsmycode.com/python-string-isidentifier/
---

The **Python String isidentifier()** method is a built-in function that returns true if the string is a valid identifier. If not it returns False.

Also read [How to Find Unique Values in a Column in Pandas](https://itsmycode.com/pandas-how-to-find-unique-values-in-a-column/)

In this article, we will learn about the **Python String `isidentifier()`** method with the help of examples.

## isidentifier() Syntax

The Syntax of **`isidentifier()`** method is:

```python 
string.isidentifier()
```

## isidentifier() Parameters

The **`isidentifier()`** method does not take any parameters.

## isidentifier() Return Value

The **`isidentifier()`** method returns

- `True` if string is a valid identifier
- `False` if the string is not a valid identifier

Checkout to documentation to learn more about [What is a valid identifier in Python?](https://docs.python.org/3.1/reference/lexical_analysis.html#identifiers)

## Example 1: How isidentifier() works?

```python 

# Python code to illustrate 
# the working of isidentifier()
  
# String with spaces
string = "Its My Code"
print(string.isidentifier())
  
# A Valid identifier
string = "ItsMyCode"
print(string.isidentifier())
  
# Empty string
string = ""
print(string.isidentifier())

# Underscore string
string = "_"
print(string.isidentifier())
  

# Alphanumeric string
string = "ItsMyC0de123"
print(string.isidentifier())
  
# Beginning with an integer
string = "123ItsMyCode"
print(string.isidentifier())
```

**Output**

```python 
False
True
False
True
True
False
```

## Example 1: How to use isidentifier() method?

```python 
# Python isidentifier() method example

str = "ItsMyCode"
# check if the string is valid identifier
if str.isidentifier() == True:
    print("{text} is an identifier".format(text=str))
else:
    print("{text} is not a valid identifier".format(text=str))
str2 = "$$ItsMyCode$$"
if str2.isidentifier() == True:
    print("{text} is an identifier".format(text=str2))
else:
   print("{text} is not a valid identifier".format(text=str2))

```

**Output**

```python 
ItsMyCode is an identifier
$$ItsMyCode$$ is not a valid identifier
```
Project 5: To-Do List, and my final week of Flatiron
Tags: javascript, react, ruby, rails
Published: 2022-01-23 06:50:48

It's been a wild ride. Since the beginning, I've been very stressed at the thought of going back to school. I'm still stressed thinking about it. I had a terrible experience in college. Coming into Flatiron, I was very apprehensive to the thought of "going back to school", but to think of how far I've come, and how much I've grown and learned, I'm glad I went for this.

And now it's time for my final project to show for it: The to-do list.

The gist of this list is that you can have your own personal to-do list, alongside multiple other *shared* to-do lists with other groups! Groups can be created by anyone, and those groups can be joined by anyone (this is to be changed soon, but I wanted the functionality of the groups to be priority).

Starting with the personal list, a to-do task has a category that can be placed with it to help organize your list! Each to-do has a checkbox in order to see if your to-do is done, and with that, the state of whether a to-do is done or not is saved. This way, the list is completely saved anytime someone refreshes their screen!

The exact same can be said for groups. The only difference between groups and the self-to-do list is that groups can work together on the same to-do list for their projects. This feature is designed with the idea of this app becoming a tool for companies and group projects!

I know for certain that I want to continue adding to this app, as well as improve the styling of it. This app will also be deployed via Heroku for anyone to use! https://to-do-list-capstone.herokuapp.com/
change the style of scroll bar with only css
Tags: css, scrollbar, style, html
Published: 2022-01-23 06:35:28

Try this cool code in your css and see the magic for yourself

body::-webkit-scrollbar {
  width: 0.55rem;
}

body::-webkit-scrollbar-track {
  background: #1e1e24;
}

body::-webkit-scrollbar-thumb {
  background: #6649b8;
}
Get yourself in Google People in a few minutes
Tags: google, seo, news
Published: 2022-01-23 06:33:09

If you are interested in getting your name in the people recommendation of Google. That not too hard and here I am gonna tell you how can you to do this.

![Gautam Jha Google Profile](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/txnxxg07zsf1ojn74iww.png)

### But first Why should we do it?

So first of all If you are a professional and you want the people to get to you easily then you should try It. of course you shouldn&#39;t follow along if you&#39;re an undercover agent xD.

If someone searches A NAME along with your profession they will be able to find you.

Ex. &quot;Gautam Jha Software Engineer&quot;

#### What do you need to do this?

- A mobile browser or a google search app
- A google account
- [Web &amp; App Activity](https://support.google.com/websearch/answer/54068) turned on

#### Next, You need to create a profile card. Follow the steps and you&#39;re there.

1. Open Google Search App or [google.com](https://www.google.com/) in your browser .
2. Search for the following key word.

- add me to google
- edit my people card.

1. You will find an option to **add yourself to Google Search.** Tap Get started.
2. Fill out the information that you want to share publicly on your card. These fields are required:
  - Summary in 350 words not sure.
  - Profession in Engineering or something.
 Social Media: not necessary
  - Website: Your portfolio or Blogs
3. At the bottom, tap Preview.
4. If you&#39;re satisfied with your card, tap Submit.

Hope, This blog will help.

**Important:** Google doesn&#39;t guarantee that your card will show up on Google Search. So more precise data you will add more likely it will appear.
Print in order traversal using stack
Tags: cpp
Published: 2022-01-23 06:28:02

## Solution

```
// C++ program to print inorder traversal 
// using stack. 
#include<bits/stdc++.h> 
using namespace std; 
  
/* A binary tree Node has data, pointer to left child 
   and a pointer to right child */
struct Node 
{ 
    int data; 
    struct Node* left; 
    struct Node* right; 
    Node (int data) 
    { 
        this->data = data; 
        left = right = NULL; 
    } 
}; 
  
/* Iterative function for inorder tree 
   traversal */
void inOrder(struct Node *root) 
{ 
    stack<Node *> s; 
    Node *curr = root; 
  
    while (curr != NULL || s.empty() == false) 
    { 
        /* Reach the left most Node of the 
           curr Node */
        while (curr !=  NULL) 
        { 
            /* place pointer to a tree node on 
               the stack before traversing 
              the node's left subtree */
            s.push(curr); 
            curr = curr->left; 
        } 
  
        /* Current must be NULL at this point */
        curr = s.top(); 
        s.pop(); 
  
        cout << curr->data << " "; 
  
        /* we have visited the node and its 
           left subtree.  Now, it's right 
           subtree's turn */
        curr = curr->right; 
  
    } /* end of while */
} 
  
/* Driver program to test above functions*/
int main() 
{ 
  
    /* Constructed binary tree is 
              1 
            /   \ 
          2      3 
        /  \ 
      4     5 
    */
    struct Node *root = new Node(1); 
    root->left        = new Node(2); 
    root->right       = new Node(3); 
    root->left->left  = new Node(4); 
    root->left->right = new Node(5); 
  
    inOrder(root); 
    return 0; 
}
```
Making Peace with Windows!Installing wsl,zsh,powerlevel10k,fzf & many more fun plugins for easy development
Tags: productivity, zsh, config, wsl
Published: 2022-01-23 06:18:56

I’m a Linux user and just love the control Linux gives me over files navigation, editing, development using terminal and zsh .Recently also found out that we can also install zsh with wsl.So this is a post on installing my development shell,plugins in windows.

https://www.codeklutz.com/-development/-/productivity/config/zsh/shell/stuff/github/linux/windows/Making-Peace-with-Windows/