Showing posts with label Editor. Show all posts
Showing posts with label Editor. Show all posts

Thursday, 13 July 2017

How to Run Python Code in NotePad++


Can you run the python code from NotePad++ ?? Question seems to be little odd but we can tweak our notepad++ settings and configure it that way. Let's see how -



1. Write few line as your python code, You can use below lines-

print("Today we are going to learn how to use notepad++ to run the python code")
print("As first step, we have to write few python code line")

input("Press Enter to Exit..........")




2. Save this file, in my case, it is saved as "npp_run.py"
3. Check the python executable path in your system. In my case it is - C:\tools\Anaconda3\python.exe  (It can be different as per your python installation)

4. Now go to Run menu or Press F5. This will open a run window as below -

5. Python below code in 'the program to run' -
Python_Executable_Path $(FULL_CURRENT_PATH)
C:\tools\Anaconda3\python.exe $(FULL_CURRENT_PATH)



6. Save this Run configuration by clicking on Save button on same window

7. Choose Run button combination (can use Ctrl + Alt + Shift + Key) and Save.

8. You can see this combination under Run Menu.


9. Now, You can run the Python code by pressing the combination buttons (My case - F9)




Things to Remember:
1. This tweak is not replacement for Python IDE :-) such as PyCharm, Spider or many others.
2. Always put the  input("Press Enter to Exit..........")at very last line of your code else you will not able to see the python code output.




Like the below page to get update  
https://www.facebook.com/datastage4you
https://twitter.com/datagenx
https://plus.google.com/+AtulSingh0/posts
https://datagenx.slack.com/messages/datascience/

Tuesday, 22 December 2015

Notepad++ tip - Find out the non-ascii characters


Working on some code and when try to compile or run arrrrrr, got a non-ascii char error ?????
Now how to resolve this, here is the way if you are using notepad++ as a text editor.



1. Ctrl-F ( View -> Find )
2. put [^\x00-\x7F]+ in search box
3. Select search mode as 'Regular expression'
4. Volla !!

This will help you to track or replace all non-ascii charater in text file.




Like the below page to get update  
https://www.facebook.com/datastage4you
https://twitter.com/datagenx
https://plus.google.com/+AtulSingh0/posts
https://groups.google.com/forum/#!forum/datagenx

Thursday, 27 August 2015

VI Editor in Linux - 1





Introduction to vi Editor 


  • Full-screen editor
  • Two modes of operation: command and text
  • Utilizes one letter commands
  • Does not format text
  • Flexible search and replace facility with pattern matching
  • Allows for user-defined editing functions using macros

Modes of Operation



The vi editor has two modes of operation. Command mode allows the user to perform
operations on the text, such as cut, paste, cursor movement, and replacement. These
operations are all invoked by one character “commands.” Text mode (also known as
insert mode) allows the user to enter text; all characters typed are inserted into the file.

There is no way to tell which mode the editor is in, other than pressing a key on the
keyboard. If the key you press is inserted into the file, the current mode is text mode. If
the key performs an action, the current mode is command mode.

Switching from command mode to text mode is done with one of the insert text
commands, which will be covered later. Returning to command mode is done by
pressing the <Esc> key.


Starting vi 


$ vi filename
  • If the file "filename" does not exist, it will be created
  • Otherwise, vi will open the existing file
When a session is initiated, one of two things happens:
  • If the file to be edited exists, a copy of the file is put into a buffer in temporary by default.
  • If the file does not exist, an empty buffer is opened for this session.
The tilde characters represent empty lines in the editor.  The editor starts in command mode.