strip

Extracting all text from a powerpoint file in VBA

江枫思渺然 提交于 2019-11-28 12:27:34
I have a huge set of powerpoint files from which I want to extract all the text and just lump it all into one big text file. Each source (PPT) file has multiple pages (slides). I do not care about formatting - only the words. I could do this manually with a file by just ^A ^C in PPT, followed by ^V in notepad; then page down in the PPT, and repeat for each slide in the powerpoint. (Too bad I can't just do a ^A that would grab EVERYTHING ... then I could use sendkey to copy / paste) But there are many hundreds of these PPTs with different numbers of slides. It seems like this would be a common

Stripping all html tags with Html Agility Pack

妖精的绣舞 提交于 2019-11-28 11:56:47
I have a html string like this: <html><body><p>foo <a href='http://www.example.com'>bar</a> baz</p></body></html> I wish to strip all html tags so that the resulting string becomes: foo bar baz From another post here at SO I've come up with this function (which uses the Html Agility Pack): Public Shared Function stripTags(ByVal html As String) As String Dim plain As String = String.Empty Dim htmldoc As New HtmlAgilityPack.HtmlDocument htmldoc.LoadHtml(html) Dim invalidNodes As HtmlAgilityPack.HtmlNodeCollection = htmldoc.DocumentNode.SelectNodes("//html|//body|//p|//a") If Not htmldoc Is

Strange behaviour of Python strip function [duplicate]

微笑、不失礼 提交于 2019-11-28 11:36:52
Possible Duplicate: python str.strip strange behavior I have following piece of code: st = '55000.0' st = st.strip('.0') print st When i execute, it print only 55 but i expect it to print 55000 . I thought that the dot in strip causing this as we usually escape it in Regular Expression so i also tried st = st.strip('\.0') but still is giving same results. Any ideas why it is not just striping .0 and why all zeros striped?? You've misunderstood strip() - it removes any of the specified characters from both ends; there is no regex support here. You're asking it to strip both . and 0 off both

how to extract string inside single quotes using python script

坚强是说给别人听的谎言 提交于 2019-11-28 10:38:27
问题 Have a set of string as follows text:u'MUC-EC-099_SC-Memory-01_TC-25' text:u'MUC-EC-099_SC-Memory-01_TC-26' text:u'MUC-EC-099_SC-Memory-01_TC-27' These data i have extracted from a Xls file and converted to string , now i have to Extract data which is inside single quotes and put them in a list. expecting output like [MUC-EC-099_SC-Memory-01_TC-25, MUC-EC-099_SC-Memory-01_TC-26,MUC-EC-099_SC-Memory-01_TC-27] Thanks in advance. 回答1: Use re.findall: >>> import re >>> strs = """text:u'MUC-EC-099

MATLAB - Remove Leading and Trailing Zeros From a Vector

只谈情不闲聊 提交于 2019-11-28 09:41:55
I have a wavelet function with leading and trailing zeros. I would like to strip all the zeros which occur before or after the wavelet. However, I would not like to remove any zeros within the wavelet itself. To simplify, let's say I have the following 1x11 vector: 0 0 0 -2 -1 0 -1 -2 0 0 0 After removing leading and trailing zeros the vector should be: -2 -1 0 -1 -2 My actual vectors are large and performance is my primary concern. I am a MATLAB novice and would appreciate any tips on how to accomplish this task as efficiently as possible. Try this y = x(find(x,1,'first'):find(x,1,'last'));

How can I Strip all regular html tags except <a></a>, <img>(attributes inside) and <br> with javascript?

爱⌒轻易说出口 提交于 2019-11-28 08:16:41
问题 When a user create a message there is a multibox and this multibox is connected to a design panel which lets users change fonts, color, size etc.. When the message is submited the message will be displayed with html tags if the user have changed color, size etc on the font. Note: I need the design panel, I know its possible to remove it but this is not the case :) It's a Sharepoint standard, The only solution I have is to use javascript to strip these tags when it displayed. The user should

Removing leading zeros before passing a shell variable to another command

[亡魂溺海] 提交于 2019-11-28 06:45:01
It turns out that iptables doesn't handle leading zeros too well. As $machinenumber that is used has to have a leading zero in it for other purposes, the idea is simply to create a new variable ( $nozero ) based on $machinenumber , where leading zeros are stripped away. $machinenumber is a two-digit number between 01 and 24. Currently it's 09 $machinetype is 74 for now and hasn't caused any problems before. What I have so far is: nozero = (echo $machinenumber | sed 's/^0*//') iptables -t nat -I POSTROUTING -s 10.($machinetype).($nozero).0/24 -j MASQUERADE While I believe I'm on the right track

How to strip type from Javascript FileReader base64 string?

爷,独闯天下 提交于 2019-11-28 06:43:14
I've got the following code in my Javascript: var reader = new FileReader(); reader.onloadend = function () { alert(reader.result); }; This shows me the following data: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAAAAABX3VL4AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gYSDCUgSze0AAAAAA5JREFUCNdjrGJgYmAAAAJ0AH4SDHVIAAAAAElFTkSuQmCC The thing is that I only want the part after the comma. I tried getting it from reader.result.value , reader.result.valueOf() and some other combinations, but can't find the correct one to JUST get the base64 string starting from after the comma. So a second

How to remove tags from a string in python using regular expressions? (NOT in HTML)

五迷三道 提交于 2019-11-28 04:35:50
I need to remove tags from a string in python. <FNT name="Century Schoolbook" size="22">Title</FNT> What is the most efficient way to remove the entire tag on both ends, leaving only "Title"? I've only seen ways to do this with HTML tags, and that hasn't worked for me in python. I'm using this particularly for ArcMap, a GIS program. It has it's own tags for its layout elements, and I just need to remove the tags for two specific title text elements. I believe regular expressions should work fine for this, but I'm open to any other suggestions. Domenic This should work: import re re.sub('<[^>]*

python How can I strip first and last double quotes

随声附和 提交于 2019-11-28 03:52:47
I want to strip double quotes from string = '"" " " ""\\1" " "" ""' to become string = '" " " ""\\1" " "" "' I tried to use rstrip , lstrip and strip('[^\"]|[\"$]') but it did not work. How can I do this? Thank you for helping me. If the quotes you want to strip are always going to be "first and last" as you said, then you could simply use: string = string[1:-1] If you can't assume that all the strings you process have double quotes you can use something like this: if string.startswith('"') and string.endswith('"'): string = string[1:-1] Edit: I'm sure that you just used string as the variable