The URL Shortening Wiki – Using Short URLs for SEO

The URL Shortening Wiki – Using Short URLs for SEO

Short URLs can and will be used for increasing domain ranking and it’s not just an SEO trick to use Short URLs.

Using Short links is a best practice.

by tyler garrett

Some url shortening services are simply important to know about as you learn more about web development Or digital marketing. Have fun!

  1. Goo.gl
  2. Ow.ly
  3. Bit.ly
  4. Wp.me
  5. Write.as
  6. Tiny.cc
  7. Is.gd
  8. Soo.gd
  9. Qr.net
  10. Gg.gg

End goal with writing about URL shortening is to key in on people who want to generate an online footprint. It’s free and easy to build a following. You need to start early, and this is one of many ways to do it.

Tweet me if you need help.

Pretend you’re the little kid from Pokemon, ash. Ash is competitive and likes collecting more Pokemon balls than other people, he would have enjoyed MySpace, friend request any Pokemon he wanted.

Well, now you’re a grown up City ash.

You’re this little box, little box 📦 ash.

A little red website who sells “red colorings of red boxes.”

You’re a practical red box lobster.

“Raaaah,” you say on Google+.

Red boxes are great i #love #red #boxes.

Then you post that on 4 different box loving google+ groups.

Four green little pokemon balls, you own them, they point back at your red-box-sales website. Following me so far?

(Oh hey, google.com links pointing at your website, blog, cat blog, red box store, pokemon backpack nightlight, etc… you can see 4 green circles and know those represent green links, you pasted in your google+ account. It’s just an app on your smartphone, laptop, or desktop. Google+ is free and builds organic traffic by increasing your ranking.)

Shortlinking for counting clicks.. *big yawn*

A shortlink counting service would tell you which of these 4 links is being clicked the most, what country, etc… giving you a quick view into your incoming traffic.

Wow, biggest yawn ever. This is boring. But, you need to know basics and that’s what this URL shortening wiki is all about. Teaching you the moves.

Mostly because…

The current mind set is to paste the same link over and over, wait a day or several days to get an update, aka google analytics & google webmaster tools. (Maybe you’ve never heard of either of these tools? They are essential to getting ranked on google and understanding user behavior on your website.)

It’s easy to add shortlinks to your typical social media output and boost your footprint quickly. I recommend adding a variety of shortlinks pointing at every web page you have ever generated, and share those on blogs, websites, comments, and with your mates on facebookinstagrammediumbloggerwordpresspinterest, etc.

Adding a shortlink to a social media post online

Adding a shortlink to your home page, as you add something hilarious on Facebook, is a bonus. Someone might click it. But google isn’t scraping private Facebook pages, or much of Facebook what so ever.

So, post again on google+ for example, like below:

It’s important to rank a website and get traffic on your website. Your website. Not someone else’s website.
Shortlinks, will help you rank.

With that said, let’s discuss URL shortening.

Google is good at counting shortened links

It counts how many quality links point at your website. So like the whiteboard above:

We can pretend — “5 links” a google robot counted.

🤖”five links”

If you’re a website with..

🤖”no links”

You aren’t selling boxes 📦.

Url shortening

Everyone says URL shortening is all about counting clicks, customizing your links, making links more actionable, etc.

What most people don’t tell you is that “shortlinks rank websites better.”

Ifyou want to know why people use URL shortening services, how I learned about URL shortening,…etc.

I wrote a little “url shortening wiki,” and hope to bridge an entrepreneurial gap with you today.

So, scroll beyond the list of link shortener services and read through the url shortening wik at the bottom of the blog. It helped me rank on google for complex terms and generates free leads.

Here’s the list of url shortening services – I’m going to explain below, show you what it looks like, and get you started.

#1) Google URL Shortener — www.goo.gl

Google URL Shortener Goo.gl is the ultimate of all short links services.

It’s currently one of the first “big names” to retire their service completely and progress it to a thing called “deep linking” — which essentially says, some people want to link you to their application, and not just a web page. I’m using goo.gl as the first example because it’s a good point to make, sometimes shortlink services stop! Google will continue the links, but some will not and it’s important to treat shortlink generation like a video game, otherwise it’s very boring and a bad investment of time.

Just because Goo.gl shortlink generating service is dead, does not mean you can not get Goo.gl shortlinks generated to help you diversify your SEO portfolio. It’s not the best solution, but find a friend or someone with access, and ask them for a couple of goo.gl links. Do it before March 13, 2019.

You can contact me, will be happy to build you a couple! Contact me at TylerGarrett.com or dev3lop.com.

What’s cool about this inactive service is that you will find out more about newer versions of the technology google is looking to implement in place of this service.

#2) Hootsuite’s — Ow.ly

Hootsuite acquired Ow.ly, I think, I don’t know. Ow.ly is easy, signup, they don’t spam you, go to your dashboard, the link builder is easy enough to click around and figure out — also you can schedule posts to social media here.

Ow.ly has been around for a bit and Hootsuite’s founder has a good story to go along with his success, which makes it cool to support the company by generating ow.ly links.

Hootsuite is a social media management platform, created by Ryan Holmes in 2008.[6]The system’s user interface takes the form of a dashboard, and supports social network integrations for TwitterFacebookInstagramLinkedInGoogle+ and YouTube.

Ow.ly is a short version of a link, that isn’t all that short, but what’s nice is it’s easy enough to generate a few links quickly, and that’s helpful.

#3) Bit.ly’s — Bit.ly

Bit.ly is a nice little link counter with a great interface for users who want to drive the needle. The other two click counters above are also helpful, powerful, but I think Bit.ly takes the overall cheese from a usability perspective.

If you’re in the market to spend a little money, I would start here, the free version works plenty and it’s the best option for customizing links currently.

Bitly is a URL shortening service and a link management platform. The company Bitly, Inc.was established in 2008. It is privately held and based in New York City. Bitly shortens 600 million links per month,[3] for use in social networking, SMS, and email. Bitly makes money by charging for access to aggregate data created as a result of many people using the shortened URLs.

Check out that link! bit.ly/sentiment-Analysis > 43 clicks!

I posted it directly to a twitter post, aiming at increasing the conversion.

 

I posted it on LinkedIn too. Here’s the data Bit.ly captures.

This post went viral on twitter.

Without bit.ly, I would not be able to understand what links are being clicked.

Check out the data coming from Twitter.

Bit.ly counted 1 less than twitter.

Impressions on twitter and link counts.

1705 impressions, 14 engagements, 15 or 14 total clicks going to the blog post about Sentiment Analysis.

The math offers conversion rate based on my output. I can start catering my content to be more like this post, as it worked more than other posts, which I was able to quickly identify and check with bit.ly.

#4) Tinyurl’s — Tinyurl.com

Tinyurl offers a shortlink service similar to others but with less of a sexy gui wrap. They offer a python version which enables you to auto generate shortlinks.

tinyurl.com isn’t pretty but it gets the job done.

Follow along and learn how to automate making shortlinks with python using tinyurl’s code library.

#4) WordPress’s — “Get Shortlink”

WordPress has an option to generate a shortlink when you’re in the editing mode on your post. If you don’t have a couple WordPress blogs, you may want to know that it’s free and a cool place to learn about blogging.

Example: https://datawebme.wordpress.com/

WordPress allows you to generate a free website within their “WORDPRESS.com” domain! It’s called a subdomain but let’s not get into that today.

Here’s a blog at TylerGarrett.com, just below the TITLE you see the Permalink? To the far right of that link is a “Get Shortlink” button.

Blog post for finding and replacing text or numbers in a csv using python.

If you open the “Get Shortlink” ->https://wp.me/p9TjFw-ey

A shortlink from wordpress!!!

Highlight that text and copy paste it as your next link to this blog!

Shortlink from wordpress!!

How to make a wp.me backlink.

If you’re looking to learn how to generate a WP.me backlink, above should help you understand that the base install of wordpress will have that button available. Also, the free version of wordpress @ wordpress.com allows you to do a similar workflow!

You can find it while you’re generating your first post! It’s easy to start, and don’t pay for anything at the start!

  1. Post settings
  2. Expand Sharing
  3. Copy wp.me link: https://wp.me/p7oMd2-2V
Finding shortlink in the free wordpress subdomain.

If you don’t have a wordpress blog, get one! You can reblog your content there, use the tags efficiently, and people will be able to find your content on the other medium/social-platform.

#5) Write.as’s — Write.as application

Write.as is a simple text input that makes webpages + links.

You can use it to keep track of your links and it’s free!

I’m throwing it in here because you can use it to be a sort of “landing page” of your signature links.

Write.as offers a place to save your shortlinks!

Example: https://write.as/i4cacvabpxn81

Also, write.as sort of looks like a shortlink.

#6) Tiny’s — Tiny.cc URL shortener

Tiny.cc is not the most attractive URL shortening service and it works.

I like this service because it offers a free custom link builder.

You don’t need to customize like this…

Example: http://tiny.cc/Find-replace-text-python

You can also use their “native” link.

I enjoy the size of this link, tiny.cc must be relatively new!

Check out the size of the link: http://tiny.cc/0566wy

More from Tiny.cc, and how they recommend using tiny urls.

One of their pitches:

“Measure the conversions for links and understand your traffic with Tiny’s statistics. We can help grow your audience and increase traffic. Shorten a link for your ad campaign and track it. Hide a link. Have an address that you don’t want to reveal… such as an affiliate link? Cloak and redirect it — the recipient will only see a short address containing the tiny.cc domain. Make a link to your online survey or invitation. And Tiny has more advanced tools such as a traffic filter that is perfect for marketing, surveys or research projects.”

#7) Is.gd’s — Is.gd a URL Shortener. Mmmm, tasty URLs!

Is.gd offers a free URL Shortener and it’s nothing crazy, until you see the stats!

is.gd is a simple URL “compression” lol

Shortening 1,298,339,529 URLs
That have been accessed 63,903,074,539 times

Crazy numbers, 63 billion accesses. A little math will explain to you how heavily used is.gd appears to be!

Example: https://is.gd/Lv9afP

Also, you can add custom keywords in your link. To generate link, with a keyword.

Custom links with “your shortened url”

Example: https://is.gd/successful_people

#8) Soo.gd’s — It’s more than just a URL shortener service.

It’s a short link service. I like their webpage title though!

Nothing pretty and it works!

Shortening links at Soo.gd is quick and easy, not sexy!

It offers a custom suffix and allows you to edit on top of that custom coded suffix.

Example: http://soo.gd/meoW

Soo meow.

Soo.gd appears to let you generate custom links, which is another plus if you’re looking to pad your keywords into your shortlink.

http://soo.gd/meoW

#9) QR.net’s — QR.net shortlink service, Create your QR code with statistics

If you need a funny looking square code thing, this offers that functionality.

If you want to walk through a process of generating an account to generate a link, it is a next step to build a qr.net link.

Example: https://qr.net/NvuTLp

Shortlinks available once you signup. It took me <1min to signup and copy the shortlink and test that it works!

QR.net is a QR code service by QR GmbH. The QR GmbH was founded in 2011 and is specialized in QR codes.

The main focus lies on the surplus value for our users. Here you create a dynamic QR code unlike many simple solutions. We offer many advantages: For example you can change the target URL of your QR codes later and view detailed statistics about the QR code calls. Our QR codes are optimized so that they can easily be printed and captured.

Examples: https://qr.net/NvuTLphttps://qr.net/Mo3tb2

#10) Gg.gg’s — URL Shortener — URL Shortening Service

GG.gg is the fastest and easy way to share (so they say on their website), save, track your links. You can use GG.gg via our website or you can download GG.gg browser extentions. You can create also custom short url if You wanna get easy to remember url. GG.gg uses powerful webservers so all Your links works extremly fast.

Nothing pretty and it works!

Example: http://gg.gg/bg505

If you need to diversify, give gg.gg a try!

So, here’s the wiki on url shortening. Scroll down to learn more.

In my url shortening wiki you will learn about:

  1. The basics of shortening links
  2. Why you should shorten links

I learned about link shortening… while frustrated.

Here’s my durp face.

Entrepreneur, loaded on coffee, competitive, and good with data — I took to Search Engine Optimization like a fish in water.

I learned about shortlinks and all the different short link services, and the ranking power associated to these shortlinks, while beating several major companies in google ranking.

Was eager to start a family, needed to learn how to drive traffic, and I noticed google keeps track of links from shortlink websites.

Learning about URL shortening was primarily for SEO purposes because it was important to beat others in ranking to build dev3loptylergarrett.com, and musicblip.com.

Before you get started, I recommend you try to treat building short links, tiny urls, and short link services.. like a game!

Gotta catch em all.

You need to get all the short links, all of them, gotta catch em all, and hope your pokemon ball doesn’t break.

Sometimes pokemon balls break, the link breaks, which means you need to choose what pokemon ball store you buy from.

If a shortlink service decides to stop providing the service, you might lose your links pointing at your domain. Let’s discuss everything in more granularity below.

Okay, last thing about pokemon and shortlinks.

The game requires you to run around, and capture pokemon, as a collection.

If you collect a lot of shortlinks, pointing at your blog, website, service page, or content online that you want to RANK higher. You will rank higher. Shortlinks carry a lot of SEO power and help you boost your ranking on searches such as GoogleBingYahoo, etc…

Drake is catching a lot of links making rad music.

Why do I even shortlink?

  1. Shortlinks make big links less ugly.
  2. If you send someone a long link, they will think you are crazy.
  3. A shortened version of a URL can generate data.
  4. Shotened URLs offer customization, increasing click chances!
  5. Because you want to rank a URL higher on a search engine. (most of you)

The basics of shortlinks and why people shortlink.

You will send someone that big link…

“Hey John, here’s that link- https://www.google.com/search?q=dogs+swimming+cute&rlz=1C1MSNA_enUS803US803&oq=dogs+swimming+cute&aqs=chrome..69i57j0l5.2255j0j7&sourceid=chrome&ie=UTF-8

You might not know this but John hates you right now.

It’s not your fault, you may have never seen a shortlink service or even know how people generated tiny links. Luckily, you’re wise and eager to learn how to keep John’s happy.

Oh, and next time, just send John the damn picture.

Aww cute picture, deserves a cute link. I won’t link to this page because it’s garbage with click bait and viruses. Who doesn’t love the internet.

Okay, if you made it this far, you’re probably interested in understanding the basics and “why would someone use a shortlink?”

Cute dog pictures aside. Let’s get started.

Did this catch your attention? At least read the following if you’re trying to learn about link shortening, and why people even…

Use shortlinks, tinyurls, link shortening, etc. if you want people to…

You will use shortlinks if you want people to…

be your friend.

to click your link.

buy you a birthday gift.

read your ‘coaching’ blog.

listen to your damn remix.

funnel to your email scheme.

Or come to your band’s show.

Or download a PDF about getting rich quickly.

Now, you’re a complete link shortening genius and writing down all the great reasons to use a little link, tiny url, whatever!!!

Quiz: is this link below short?

This link is long and ugly: https://medium.com/@itylergarrett.tag/the-basics-of-sentiment-analysis-an-intro-to-python-sentiment-automation-69808679dfd7 AND UGLY.

Answer: this link is not short.

The next link is short…

This link is shortened: http://bit.ly/sentiment-Analysis

Short links are better.

Short links are better when you need to show off the link.

Shortlinks are better because they are inviting, explains what you get, and doesn’t look like spam.

Also, if there’s a service to capture the amount of clicks, we could identify the same link two times on 1 website, email, etc… To understand what people click the most.

A story: I applied to hundreds of jobs and had a link to my portfolio. It wasn’t until I started learning about shortlinks, where I was able to understand if people speaking to me, read my resume, and if they did read my resume, what links did they click in my resume. Without knowing your audience and their habits, how are you expected to convert the user to a customer, check if your employee clicked on a link you sent them, or question people reading your resume because they clearly didn’t click to see your portfolio… Hmmm…

Let’s start building short links!

Free shortlink generators or URL shorteners are free, free of course because why would I pay for a redirect!?

You can build your own version of small URLS on your domain rather easily with most web developer tools/plugins.

But you can also use one or several shortlink tools available online. It typically takes 2 to 5’clicks and boom you have a shortlink!

You can make our own short links on your domain. But this stuff works too.

For example, I used to rank on Tableau Consulting in 140 countries, in the top 5 on google. I learned about shortlinks while trying to catch up to all the cheating happening in these searches.

Using shortlinks is a strategic way to beat cheaters, Each link is a +1, and google keeps track of what people are clicking on in your article — but without a different link, to count, how can I tell you clicked on this link, or this link to our tableau consulting squeeze page?

It’s important to diversify the links,..

Because google counts these as direct links pointing at your domain, every link is a +1. Your competitor only cares about links, not where it’s coming from, so the outlier is, don’t cheat like them!

The google algorithm is programmed by measuring the amount of links out there. Every link takes them to a new source of data, a new page of html. The shortlink service or URL shortener offers you the ability to generate a link that takes you wherever you program the traffic to go.

Generally, 🤖these shortlinks last forever. If the webmaster or creator of the service decides to kill it, all of the links die. It’s a risk — so play with caution and excitement.

Finding a shortlink service that works, is like running into a digital kind of pokemon, and you gotta catch’em all. Some will escape, buy better poke balls.

Did you enjoy the comprehensive list of shortlink generator services?

Hopefully you enjoyed the list, if you’re looking to learn more about things I blog about, check out dev3lop.com.

Setting up Pip on Python 3.7 in Windows 10 — A non-developer version

Setting up Pip on Python 3.7 in Windows 10 — A non-developer version

Ready to start learning python? You may think installing python 3.7 is the right step, I recommend starting with python 2.7 and upgrade if necessary. If you insist, here’s how to get python 3.7 on windows 10 pc.

After this blog you will..

  1. become yoda
  2. install python 3.7 on windows 10
  3. use python 3.7
  4. links to tutorials and beginner info

Installing python on windows PC!

If you’re running Windows: the most stable Windows downloads are available from the Python for Windows page. Screenshot walkthrough, step by step, on bottom of recommendations portion, built for new people learning to install python on windows PC for the first time.

  1. Visit the python for windows page.
  2. Download python 3.7.0 by clicking the link in step 3.
  3. https://www.python.org/ftp/python/3.7.0/python-3.7.0-webinstall.exe
  4. Begin the download and follow screenshot instructions below.

If you get stuck or lost — you can ask me for helpIf you’re a first timer, and you just think python 3.7 install on windows 10 is the next best step…

Please, read through and learn from my awful mistakes.

Need to learn more about python install and my recommendations?

I made a bunch of stupid mistakes learning python because there’s lame ass websites ranking and they don’t really have very good content. Like Python For Beginners — spams malicious popup ads, I blog about it in that link.

Before we begin, I want to mention…

I also write about uninstalling python 3.7 because my project ended up requiring 2.7, which is available natively if you have a macbook!

Quick hint, keep your installer! You likely don’t need python 3.7 today if you’re new, and you likely will be better off using an older version, which will have more documentation, college courses, smarter people than me… Blogging about these older versions, for over a decade… But if you insist. The answer to installing python 3.7 is one header down.

If you’re not already using pycharm, I strongly consider you find a smart python writing tool, if you really need python on your local computer, I’m going to recommend stop…

Downloading and installing on your local machine isn’t necessary and could cause issues if you already have a version installed and you’re not familiar with the basics… I understand because I, Tyler Garrett, also sucked a lot at this portion and felt obliged to share the solution and the journey.

Screenshots from installing python on windows PC Python Release 3.7.0

Open your executable.

Or if you’re not that techie, navigate to your download folder…

Or search your computer for python-3.7.0-webinstall.exe

Screen shot 1 from python release 3.7.0
Install now option works for me! Check add python 3.7 to path to add it to your system variables, i guess…. we will look at that later. Worst case scenario, it’s unchecked for a reason and reinstall would not hurt you at this point.
Setup progress — I’m literally always happy to get a screenshot during this progress bar load. I wonder how well this screenshot will rank next to other python 3.7.0 tutorials.
Only 4 screenshots! Not a bad little install. Open online tutorial and documentation to get your beak wet, or scroll down because like I said above, I don’t want you to have to google a lot of stuff, scroll below to learn more about python or get a refresher. Also, links to tutorials built by Python!

Testing to see if python 3.7.0 installed on your windows machine

  1. find your python.exe executable.
  2. Here’s where mine was located:

C:\Users\tyler\AppData\Local\Programs\Python\Python37–32\python.exe

Show hidden items or folders to find your appdata directory.

Double click python.exe!

A black screen opens and you will see something like:

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>>

You will be able to type in front of >>>

Type 2+2+1

Congrats, you just used Python to do basic aggregation.

“next steps: check out setting up pip on python 3.7 below”

A quick tutorial on setting a constant value of X to True, and then processing it through an if statement to print text. Pretty exciting because I thought it would be more complex to dive into if-statements.

“Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.” Source.

“The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, https://www.python.org/, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation.” Source.

The Glossary is also worth going through.

Python.org offers a Wiki — https://wiki.python.org/moin/BeginnersGuide/Download

So if you’re not sure what you should download, and you’re not looking to use a PC with python, go look here to begin.

Here’s a quick deep dive into python.

By the way, the language is named after the BBC show “Monty Python’s Flying Circus” and has nothing to do with reptiles. Making references to Monty Python skits in documentation is not only allowed, it is encouraged! Source.

Python allows you to split your program into modules that can be reused in other Python programs. It comes with a large collection of standard modules that you can use as the basis of your programs — or as examples to start learning to program in Python.

If you do much work on computers, eventually you find that there’s some task you’d like to automate.

Alright, cool story, have fun.

So…

IfI’m not building analytics apps at work, or helping musicians download free loops and samples.. I enjoy writing terribly about Python, or other tech tutorials.

Typos by Tyler Garrett

Previous version of the python 3.7 blog, back when i typed more than coded.

Install python, or do my how to install python 3.7 windows 10. This can be accomplished using the python installer at python.org. Setting up Python 3.7 on windows 10, the non-developer tutorial for those who don’t want to figure out every little aspect, and prefer having someone teach them the path to success. Read more of my python struggles here.

Python 3.7 is rad — I wanted to originally use it but I realized I was not able to shorten links with the tinyurl library, so I reverted back to a version that allowed me to use the tinyurl library (python 2.7).

After you download the latest version of python, like python 3.7, you have a little bit of a journey ahead of you. Let’s begin.

Python requires a type of installer to gain access to complex libraries written in god only knows… The goal is you don’t need to write these complex libraries from scratch, you can call them up, with non-complex code, and get away with practical murder from an automation perspective.

I’m excited about the fact that I can build what I want in a few lines of code — and so far it makes sense. But to get to the point of making your apps, we need some foundation, a means of downloading, there are a few methods, let’s start with the pip method first.

Now now… if you’re new… Don’t worry about the latest version. You will not need 3.7 for awhile. Download python 2.7 first and find an updated version of 2.7. Otherwise you will be playing with a lot of environment variables and dependencies, which make it complicated to learn fast.

Seriously, 2.7 is easier for newbs. Go there first. I’m learning on 2.7 and after writing this blog for 3.7, I realized I wanted to be on a later version to use fun stuff like building short links with tinyurl in python.

Setting up Python 3.7 Pip on Windows 10

Next steps are rather easy, you can follow along, and setup your python pip installer — without breaking a sweat, on windows 10.

Start by getting →get-pip.py from https://bootstrap.pypa.io/get-pip.py

Right click the website and save this to your desktop.

Double click the get-pip.py file, and wait for the installer to complete. That’s all, now pip works. Check it by following this next step.

Testing PIP is working with your new python 3.7 install on windows 10

Open your cmd terminal thingy, hit the windows key, type cmd, hit enter. Your terminal should automatically popup.

How to quickly access your command prompt or CMD on windows 10.

Type “pip” in CMD to learn more about pip

/!\ Before do anything, install or upgrade the Setuptools Python package. It contain compatibility improvements and add automatic use of compiler
pip install — upgrade setuptools

install microsoft visual C++ 14 — setting up visual studio build tools 2017

Installing microsoft visual c++ 14 seems to be necessary when setting up lxml, a type of parsing tool that allows you to quickly parse XML and HTML, which we will want to build our web parsing, or scraping tools.

visual studio installer build tools 2017 c++ 14.0 etc etc etc… takes time, start it now.

Will know if our pip install lxml errors clear up after this restart (oh yeah and restart is necessary here).

Start early, the next part takes longer.

Getting this pip installer thing going takes a little bit, but luckily I’ve consolidated it here lol.

The install takes a little bit of time too.

setting up visual studio build tools 2017
As you’re installing, go check out your next hurdle. Beautiful soup!

Here’s what you need to check out to knock out the visual studio portion.

  1. https://wiki.python.org/moin/WindowsCompilers explains the basics.
  2. https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017 shows you what to download.

Run the installer, don’t select anything other than default settings, and click install. It takes a little bit, and then you need to restart.

Once we get back from the restart, we will do the following pip installs.

pip install lxml (breaks with out c++14.0.)
pip install requests (ran this early, seems to install no hiccups.)

pip install beautifulsoup4 (ran this early, seems to install no hiccups.)

Will report back and iron out these posts more later.

If you have trouble with your pip install on python2 vs python3, or something along those lines, check out this next blog… sometimes you can get ahead, and there are a few things to ensure you have completed, like the above mumble jumble.

Update, started using pycharm and rather enjoying it. It’s a type of code editing “easy mode” application that you might want someone to walk you through a few times. Or google a youtube video. I figured it out without googling or looking anything up, which means you can fly past me with the right mentor.

Blogged here: https://medium.com/@itylergarrett.tag/setting-up-python-3-7-on-windows-10-a-non-developer-tutorial-e836639ca16

Find and Replace in a CSV using Python

Find and Replace in a CSV using Python

Below is a quick tutorial on using a type of “find and replace” across a CSV file or you could do this find and replace on a TXT file too.

I’m not a developer, just another blogger, blogging about learning python.

I’m building use cases that are similar to a typical business analyst or data analyst.

The goal is to build a user friend guide, that allows end users with any skill level to understand the methods used to handle “find and replace” in a file, using python.

You get a CSV file or TEXT file and want to scrape over the entire file, and output it with your modifications. Find and replace is the term I would think you would google if you wanted to do a find and replace in python over a CSV.

Here’s a typical CSV file.
Delimited by a comma.

Name,Number,Rank,Website,Flag,Cat
Tyler,43,1,https://tylergarrett.com,Yes,0
Jeff,36,2,https://tylergarrett.com,No,0
Isabelle,57,3,https://tylergarrett.com,Yes,0
Mury,84,4,https://tyler-garrett.com,No,0
Meow,96,6,https://tylergarrett.com,Yes,1
Cats,25,5,https://tylergarr3tt.com,no,1

→ Save file as input.csv

Python, without any downloaded libraries, will do a find and replace on the data above. You can copy and paste the data above into a .txt file, and change the extension to .csv — if you don’t have an excel software on your computer, or you can use Google sheets and make your own data problem.

Our goal is to clean the 3.

The 3 in the https://tylergarr3tt.com link because it’s not accurate.

For whatever reason this is going to be used by a developer and they are asking me to find and replace the “errors.”

Errors in the sample data generate a use case to learn how to do a find and replace on a CSV file, which taught me that using the a previous “text file” tutorial, I was able to handle the same ETL like solution, with simple python code, and no odd libraries to be imported.

No downloaded libraries means you’re free to only get access to python on your work station, this is key in enterprise situations where every new download becomes a new request of your IT department. A new request means a new approval from your manager too.

by tyler garrett

Our use case will generate a full “find and replace python solution” and a few more obvious data issues.

We will remove “3” and replace it with “e” in python below, to help us move down a path of learning and solving your use case today.

The code to find and replace anything on a CSV using python

text = open("input.csv", "r")
text = ''.join([i for i in text]) \
    .replace("3", "e")
x = open("output.csv","w")
x.writelines(text)
x.close()

We are not using any “imports” because this is all native python capability.

Let’s see what the output looks like.

Name,Number,Rank,Website,Flag,Cat
Tyler,4e,1,https://tylergarrett.com,Yes,0
Jeff,e6,2,https://tylergarrett.com,No,0
Isabelle,57,e,https://tylergarrett.com,Yes,0
Mury,84,4,https://tyler-garrett.com,No,0
Meow,96,6,https://tylergarrett.com,Yes,1
Cats,25,5,https://tylergarrett.com,no,1

Successfully cleaning the “3” and also adding an “e” where our “3” used to be.

Look at line 2 & line 3 before:

Jeff,36,2,https://tylergarrett.com,No,0
Isabelle,57,3,https://tylergarrett.com,Yes,0

Look at line 2 & line 3 after:

Jeff,e6,2,https://tylergarrett.com,No,0
Isabelle,57,e,https://tylergarrett.com,Yes,0

The small portion of code:

text = ''.join([i for i in text]) \
    .replace("3", "e")

Allows you to “find and replace” using one line of code.

It looks like 2 lines of code because python lets you put a space and a “\” in front of a long line of code. The space + “\” lets me see what I’m doing easier that writing one wrapping line of code.

An example that may require a “ \” in front of your code, looks something like…because it’s easier to read.

Simple python transformation can be complicated.

Above image of code is an exaggeration to show you that python lets you break up your find and replace or you can do it in one line. I do it because I would go absolutely crazy if it wasn’t for that little feature, so if you’re like me, woop woop. This is a big help, otherwise

→write it like this…

text = ''.join([i for i in text]).replace("3", "e")

Above code lets us quickly replace “3”’s with “e”’s and lets us heal our link column in the csv file. Find and replace may require a more granular approach which will be covered in another lesson.

Final code to find and replace text in a CSV with python

Find and replace text or letters in a csv with python is simple, super fast, faster than any SQL stuff I’ve played with in the past, so — if you need to bulk process a CSV or TEXT file — python is a great direction because it’s easy to understand.

text = open("input.csv", "r")
text = ''.join([i for i in text]).replace("3", "e")
x = open("output.csv","w")
x.writelines(text)
x.close()

‘’.join is cool because it allows you to add anything, to each row of data.

Notice how…

text = '1'.join([i for i in text]) \

Adds a “1” to each row of data…

Name,Number,Rank,Website,Flag,Cat
1Tyler,4e,1,https://tylergarrett.com,Yes,0
1Jeff,e6,2,https://tylergarrett.com,No,0
1Isabelle,57,e,https://tylergarrett.com,Yes,0
1Mury,84,4,https://tyler-garrett.com,No,0
1Meow,96,6,https://tylergarrett.com,Yes,1
1Cats,25,5,https://tylergarrett.com,no,1

How exciting…

text = open("input.csv", "r")
text = '1.......+'.join([i for i in text]) \
    .replace("3", "e") \
    .replace('+','+\n')
x = open("output.csv","w")
x.writelines(text)
x.close()

Generates…

Name,Number,Rank,Website,Flag,Cat
1.......
Tyler,4e,1,https://tylergarrett.com,Yes,0
1.......
Jeff,e6,2,https://tylergarrett.com,No,0
1.......
Isabelle,57,e,https://tylergarrett.com,Yes,0
1.......
Mury,84,4,https://tyler-garrett.com,No,0
1.......
Meow,96,6,https://tylergarrett.com,Yes,1
1.......
Cats,25,5,https://tylergarrett.com,no,1

Find and replace in python, using the basics. You can use a .txt file too, for both input and output.

Later you will learn split() is a lot of fun to use.

By Tyler Garrett

Built a Tableau Consulting thing and now i do other stuff.