What Does Colon Equals Mean In Python? The New Walrus Operator :=

In Python 3.8 a new assignment expression hit allowing for easier access of variables that are used when being assigned. Here are some tips on how this can be used in your everyday coding. Wait, what’s an assignment expression? You may have heard of the term assignment operator and seen its use in the wild when doing things like incrementing a variable by 1 in Python. This is where an operator, like + or - is combined with the assignment key =. For example, x += 1 which means I’m adding the value of 1 to the variable x. ...

March 11, 2022 · 4 min · 808 words · Ryan Sheehy

We're sorry, a server error occurred while reading from storage. Error code NOT_FOUND

What do you do when you’re running a Google App Script and you encounter the following error in the Execution Log area? W e ' r e s o r r y , a s e r v e r e r r o r o c c u r r e d w h i l e r e a d i n g f r o m s t o r a g e . E r r o r c o d e N O T _ F O U N D . Check the libraries you have attached to your project on the left-hand side and see if they are correctly referencing the versions you need from them to operate your code properly. ...

March 11, 2022 · 2 min · 305 words · Ryan Sheehy

How To Zip Two Or Multiple Lists Together In Python

How do you zip two lists together in Python? What if you want to zip multiple lists together, is it the same process or something different? The built-in function zip() allows users to combine iterables, such as a list, into tuples by taking each corresponding item from the lists passed into its parameters merging the lists into one. It does not matter whether you have two or multiple lists the function are the list parameters are the same. ...

March 10, 2022 · 5 min · 859 words · Ryan Sheehy

Python Initialize Dictionary: Use Dict Constructor Or Dict Literal?

How do you initialize an empty dictionary in Python? Is it best to use dict() or {}? There are two common ways of initializing a dictionary in Python. One involves using the built-in function dict() and is known as the dict constructor, whereas the other method is known as dict literal and has the syntax {}. Here’s an example demonstrating how to initialize using both approaches in the Python REPL: ...

March 10, 2022 · 5 min · 957 words · Ryan Sheehy

How To Get First And Last N Characters From A String In Python

It can be quite easy to get the first character in a string, but how can you get the first n characters from a string? Or what about the last n characters? To get more than one character from a string you can use the slice operator which has the syntax [start:stop:step]. For example, to get the first 5 characters from a string variable my_string use the slice operator as follows my_string[:5] or to get the last 5 characters from a string use my_string[-5:]. ...

February 26, 2022 · 5 min · 1019 words · Ryan Sheehy

How To Clean And Format Phone Numbers In Google Sheets

If you’re working with data in Google Sheets you’ll soon come across a time when you will need to clean and format phone number data entries. To clean phone numbers in Google Sheets using the REGEXEXTRACT() function extract all the different fields according to the phone number entries and then combine them all into the desired format. Here’s an example walking step by step through the process of cleaning the data set first, before then moving on to creating the desired phone number format. ...

February 25, 2022 · 9 min · 1712 words · Ryan Sheehy

How To Increment By 2 Or More In For Loop In Python [Examples]

How do you increment through a for loop by 2 or more using Python? To iterate by 2 or more when processing a for loop expression use the third parameter of the range(start, stop, step) built-in function, or if using the slice operator use the third parameter. Here is an example demonstrating how to iterate through a for-loop in Python using the range() function. 1 2 3 4 5 6 7 8 9 10 11 12 13 >>> for i in range(0, 10, 1): ... print(i) ... 0 1 2 3 4 5 6 7 8 9 As you can see from the above code the range() function takes three parameters: start, stop and step. ...

February 20, 2022 · 4 min · 663 words · Ryan Sheehy

Check Phone Numbers Using Regex In Python [Examples]

How can you use the Python Regex library to check if a string represents a phone number? To check if a string matches a specific pattern use the Regex library’s match or exec methods. Before writing your Regex pattern inspect the variants for the phone number field to see whether you’re Regex pattern will match. For example, if upon your inspection you find the following variants: + 0 0 6 ( 0 1 6 4 4 1 0 2 2 1 1 1 4 2 3 3 0 2 2 1 ) 4 4 - 2 5 4 1 3 3 . 3 6 5 2 4 4 3 4 7 6 3 5 5 4 5 8 7 4 - 5 9 5 6 6 . 6 H 6 7 7 6 7 W o 7 8 8 7 8 o m 8 8 9 r e - k M u m By noting all the different variants you should be able to write your Regex pattern to capture all these types that are valid phone numbers. ...

February 19, 2022 · 5 min · 956 words · Ryan Sheehy

How To Stop A Map/Reduce SuiteScript When It Is Processing

How do you stop a long running map/reduce script in SuiteScript? There are two ways to stop the running of a map/reduce script: cancel the script in the Map/Reduce Script Status area, or make the running Map/Reduce script inactive. Here’s how each method works. Cancel Map/Reduce Script You might be able to stop a map/reduce script running in SuiteScript if there are other scripts running currently and your newly pushed map/reduce script is sitting in the queue. ...

February 14, 2022 · 2 min · 350 words · Ryan Sheehy

5 Alternatives To VLOOKUP Function: How To Get Values To The Left Of VLOOKUP Range

How do you get the value from a column that is to the left of a VLOOKUP range? The VLOOKUP function is a powerful function that enables you to capture the value from a range, provided the value is to the right of the lookup range. For example, suppose you have the following data in your spreadsheet that contains the employee ID in column A, the name of the employee in column B and their hire date in column C. You cannot search by column B to return column A using the VLOOKUP function. ...

February 12, 2022 · 8 min · 1687 words · Ryan Sheehy